Introducing Regular Expressions

Total Page:16

File Type:pdf, Size:1020Kb

Introducing Regular Expressions Introducing Regular Expressions wnload from Wow! eBook <www.wowebook.com> o D Michael Fitzgerald Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo Introducing Regular Expressions by Michael Fitzgerald Copyright © 2012 Michael Fitzgerald. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or [email protected]. Editor: Simon St. Laurent Indexer: Lucie Haskins Production Editor: Holly Bauer Cover Designer: Karen Montgomery Proofreader: Julie Van Keuren Interior Designer: David Futato Illustrator: Rebecca Demarest July 2012: First Edition. Revision History for the First Edition: 2012-07-10 First release See http://oreilly.com/catalog/errata.csp?isbn=9781449392680 for release details. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Introducing Regular Expressions, the image of a fruit bat, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information con- tained herein. ISBN: 978-1-449-39268-0 [LSI] 1341860829 Table of Contents Preface ..................................................................... vii 1. What Is a Regular Expression? ............................................. 1 Getting Started with Regexpal 2 Matching a North American Phone Number 2 Matching Digits with a Character Class 4 Using a Character Shorthand 5 Matching Any Character 5 Capturing Groups and Back References 6 Using Quantifiers 6 Quoting Literals 8 A Sample of Applications 9 What You Learned in Chapter 1 11 Technical Notes 11 2. Simple Pattern Matching ................................................ 13 Matching String Literals 15 Matching Digits 15 Matching Non-Digits 17 Matching Word and Non-Word Characters 18 Matching Whitespace 20 Matching Any Character, Once Again 22 Marking Up the Text 24 Using sed to Mark Up Text 24 Using Perl to Mark Up Text 25 What You Learned in Chapter 2 27 Technical Notes 27 3. Boundaries ........................................................... 29 The Beginning and End of a Line 29 Word and Non-word Boundaries 31 iii Other Anchors 33 Quoting a Group of Characters as Literals 34 Adding Tags 34 Adding Tags with sed 36 Adding Tags with Perl 37 What You Learned in Chapter 3 38 Technical Notes 38 4. Alternation, Groups, and Backreferences ................................... 41 Alternation 41 Subpatterns 45 Capturing Groups and Backreferences 46 Named Groups 48 Non-Capturing Groups 49 Atomic Groups 50 What You Learned in Chapter 4 50 Technical Notes 51 5. Character Classes ...................................................... 53 Negated Character Classes 55 Union and Difference 56 POSIX Character Classes 56 What You Learned in Chapter 5 59 Technical Notes 60 6. Matching Unicode and Other Characters ................................... 61 Matching a Unicode Character 62 Using vim 63 Matching Characters with Octal Numbers 64 Matching Unicode Character Properties 65 Matching Control Characters 68 What You Learned in Chapter 6 70 Technical Notes 71 7. Quantifiers ............................................................ 73 Greedy, Lazy, and Possessive 74 Matching with *, +, and ? 74 Matching a Specific Number of Times 75 Lazy Quantifiers 76 Possessive Quantifiers 77 What You Learned in Chapter 7 78 Technical Notes 79 iv | Table of Contents 8. Lookarounds .......................................................... 81 Positive Lookaheads 81 Negative Lookaheads 84 Positive Lookbehinds 85 Negative Lookbehinds 85 What You Learned in Chapter 8 86 Technical Notes 86 9. Marking Up a Document with HTML ....................................... 87 Matching Tags 87 Transforming Plain Text with sed 88 Substitution with sed 89 Handling Roman Numerals with sed 90 Handling a Specific Paragraph with sed 91 Handling the Lines of the Poem with sed 91 Appending Tags 92 Using a Command File with sed 92 Transforming Plain Text with Perl 94 Handling Roman Numerals with Perl 95 Handling a Specific Paragraph with Perl 96 Handling the Lines of the Poem with Perl 96 Using a File of Commands with Perl 97 What You Learned in Chapter 9 98 Technical Notes 98 10. The End of the Beginning .............................................. 101 Learning More 102 Notable Tools, Implementations, and Libraries 103 Perl 103 PCRE 103 Ruby (Oniguruma) 104 Python 104 RE2 105 Matching a North American Phone Number 105 Matching an Email Address 105 What You Learned in Chapter 10 106 Appendix: Regular Expression Reference ....................................... 107 Regular Expression Glossary .................................................. 123 Index ..................................................................... 129 Table of Contents | v Preface This book shows you how to write regular expressions through examples. Its goal is to make learning regular expressions as easy as possible. In fact, this book demonstrates nearly every concept it presents by way of example so you can easily imitate and try them yourself. Regular expressions help you find patterns in text strings. More precisely, they are specially encoded text strings that match patterns in sets of strings, most often strings that are found in documents or files. Regular expressions began to emerge when mathematician Stephen Kleene wrote his book Introduction to Metamathematics (New York, Van Nostrand), first published in 1952, though the concepts had been around since the early 1940s. They became more widely available to computer scientists with the advent of the Unix operating system— the work of Brian Kernighan, Dennis Ritchie, Ken Thompson, and others at AT&T Bell Labs—and its utilities, such as sed and grep, in the early 1970s. The earliest appearance that I can find of regular expressions in a computer application is in the QED editor. QED, short for Quick Editor, was written for the Berkeley Time- sharing System, which ran on the Scientific Data Systems SDS 940. Documented in 1970, it was a rewrite by Ken Thompson of a previous editor on MIT’s Compatible Time-Sharing System and yielded one of the earliest if not first practical implementa- tions of regular expressions in computing. (Table A-1 in Appendix documents the regex features of QED.) I’ll use a variety of tools to demonstrate the examples. You will, I hope, find most of them usable and useful; others won’t be usable because they are not readily available on your Windows system. You can skip the ones that aren’t practical for you or that aren’t appealing. But I recommend that anyone who is serious about a career in com- puting learn about regular expressions in a Unix-based environment. I have worked in that environment for 25 years and still learn new things every day. “Those who don’t understand Unix are condemned to reinvent it, poorly.” —Henry Spencer vii Some of the tools I’ll show you are available online via a web browser, which will be the easiest for most readers to use. Others you’ll use from a command or a shell prompt, and a few you’ll run on the desktop. The tools, if you don’t have them, will be easy to download. The majority are free or won’t cost you much money. This book also goes light on jargon. I’ll share with you what the correct terms are when necessary, but in small doses. I use this approach because over the years, I’ve found that jargon can often create barriers. In other words, I’ll try not to overwhelm you with the dry language that describes regular expressions. That is because the basic philoso- phy of this book is this: Doing useful things can come before knowing everything about a given subject. There are lots of different implementations of regular expressions. You will find regular expressions used in Unix command-line tools like vi (vim), grep, and sed, among others. You will find regular expressions in programming languages like Perl (of course), Java, JavaScript, C# or Ruby, and many more, and you will find them in declarative lan- guages like XSLT 2.0. You will also find them in applications like Notepad++, Oxygen, or TextMate, among many others. Most of these implementations have similarities and differences. I won’t cover all those differences in this book, but I will touch on a good number of them. If I attempted to document all the differences between all implementations, I’d have to be hospitalized. I won’t get bogged down in these kinds of details in this book. You’re expecting an introductory text, as advertised, and that is what you’ll get. Who Should Read This Book The audience for this book is people who haven't ever written a regular expression before. If you are new to regular expressions or programming, this book is a good place to start. In other words, I am writing for the reader who has heard of regular expressions and is interested in them but who doesn’t really understand them yet. If that is you, then this book is a good fit. The order I’ll go in to cover the features of regex is from the simple to the complex. In other words, we’ll go step by simple step. Now, if you happen to already know something about regular expressions and how to use them, or if you are an experienced programmer, this book may not be where you want to start. This is a beginner’s book, for rank beginners who need some hand- holding. If you have written some regular expressions before, and feel familiar with them, you can start here if you want, but I’m planning to take it slower than you will probably like.
Recommended publications
  • Preview Objective-C Tutorial (PDF Version)
    Objective-C Objective-C About the Tutorial Objective-C is a general-purpose, object-oriented programming language that adds Smalltalk-style messaging to the C programming language. This is the main programming language used by Apple for the OS X and iOS operating systems and their respective APIs, Cocoa and Cocoa Touch. This reference will take you through simple and practical approach while learning Objective-C Programming language. Audience This reference has been prepared for the beginners to help them understand basic to advanced concepts related to Objective-C Programming languages. Prerequisites Before you start doing practice with various types of examples given in this reference, I'm making an assumption that you are already aware about what is a computer program, and what is a computer programming language? Copyright & Disclaimer © Copyright 2015 by Tutorials Point (I) Pvt. Ltd. All the content and graphics published in this e-book are the property of Tutorials Point (I) Pvt. Ltd. The user of this e-book can retain a copy for future reference but commercial use of this data is not allowed. Distribution or republishing any content or a part of the content of this e-book in any manner is also not allowed without written consent of the publisher. We strive to update the contents of our website and tutorials as timely and as precisely as possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt. Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our website or its contents including this tutorial. If you discover any errors on our website or in this tutorial, please notify us at [email protected] ii Objective-C Table of Contents About the Tutorial ..................................................................................................................................
    [Show full text]
  • Strings in C++
    Programming Abstractions C S 1 0 6 X Cynthia Lee Today’s Topics Introducing C++ from the Java Programmer’s Perspective . Absolute value example, continued › C++ strings and streams ADTs: Abstract Data Types . Introduction: What are ADTs? . Queen safety example › Grid data structure › Passing objects by reference • const reference parameters › Loop over “neighbors” in a grid Strings in C++ STRING LITERAL VS STRING CLASS CONCATENATION STRING CLASS METHODS 4 Using cout and strings int main(){ int n = absoluteValue(-5); string s = "|-5|"; s += " = "; • This prints |-5| = 5 cout << s << n << endl; • The + operator return 0; concatenates strings, } and += works in the way int absoluteValue(int n) { you’d expect. if (n<0){ n = -n; } return n; } 5 Using cout and strings int main(){ int n = absoluteValue(-5); But SURPRISE!…this one string s = "|-5|" + " = "; doesn’t work. cout << s << n << endl; return 0; } int absoluteValue(int n) { if (n<0){ n = -n; } return n; } C++ string objects and string literals . In this class, we will interact with two types of strings: › String literals are just hard-coded string values: • "hello!" "1234" "#nailedit" • They have no methods that do things for us • Think of them like integer literals: you can’t do "4.add(5);" //no › String objects are objects with lots of helpful methods and operators: • string s; • string piece = s.substr(0,3); • s.append(t); //or, equivalently: s+= t; String object member functions (3.2) Member function name Description s.append(str) add text to the end of a string s.compare(str) return
    [Show full text]
  • PHP 8.0.2 - Phpinfo() 2021-02-23 14:53
    PHP 8.0.2 - phpinfo() 2021-02-23 14:53 PHP Version 8.0.2 System Linux effa5f35b7e3 5.4.83-v7l+ #1379 SMP Mon Dec 14 13:11:54 GMT 2020 armv7l Build Date Feb 9 2021 12:01:16 Build System Linux 96bc8a22765c 4.15.0-129-generic #132-Ubuntu SMP Thu Dec 10 14:07:05 UTC 2020 armv8l GNU/Linux Configure Command './configure' '--build=arm-linux-gnueabihf' '--with-config-file-path=/usr/local/etc/php' '--with-config-file-scan- dir=/usr/local/etc/php/conf.d' '--enable-option-checking=fatal' '--with-mhash' '--with-pic' '--enable-ftp' '--enable- mbstring' '--enable-mysqlnd' '--with-password-argon2' '--with-sodium=shared' '--with-pdo-sqlite=/usr' '--with- sqlite3=/usr' '--with-curl' '--with-libedit' '--with-openssl' '--with-zlib' '--with-pear' '--with-libdir=lib/arm-linux-gnueabihf' '- -with-apxs2' '--disable-cgi' 'build_alias=arm-linux-gnueabihf' Server API Apache 2.0 Handler Virtual Directory Support disabled Configuration File (php.ini) Path /usr/local/etc/php Loaded Configuration File /usr/local/etc/php/php.ini Scan this dir for additional .ini files /usr/local/etc/php/conf.d Additional .ini files parsed /usr/local/etc/php/conf.d/docker-php-ext-gd.ini, /usr/local/etc/php/conf.d/docker-php-ext-mysqli.ini, /usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini, /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini, /usr/local/etc/php/conf.d/docker-php-ext-zip.ini PHP API 20200930 PHP Extension 20200930 Zend Extension 420200930 Zend Extension Build API420200930,NTS PHP Extension Build API20200930,NTS Debug Build no Thread Safety disabled Zend Signal Handling enabled
    [Show full text]
  • Variable Feature Usage Patterns in PHP
    Variable Feature Usage Patterns in PHP Mark Hills East Carolina University, Greenville, NC, USA [email protected] Abstract—PHP allows the names of variables, classes, func- and classes at runtime. Below, we refer to these generally as tions, methods, and properties to be given dynamically, as variable features, and specifically as, e.g., variable functions expressions that, when evaluated, return an identifier as a string. or variable methods. While this provides greater flexibility for programmers, it also makes PHP programs harder to precisely analyze and understand. The main contributions presented in this paper are as follows. In this paper we present a number of patterns designed to First, taking advantage of our prior work, we have developed recognize idiomatic uses of these features that can be statically a number of patterns for detecting idiomatic uses of variable resolved to a precise set of possible names. We then evaluate these features in PHP programs and for resolving these uses to a patterns across a corpus of 20 open-source systems totaling more set of possible names. Written using the Rascal programming than 3.7 million lines of PHP, showing how often these patterns occur in actual PHP code, demonstrating their effectiveness at language [2], [3], these patterns work over the ASTs of the statically determining the names that can be used at runtime, PHP scripts, with more advanced patterns also taking advantage and exploring anti-patterns that indicate when the identifier of control flow graphs and lightweight analysis algorithms for computation is truly dynamic. detecting value flow and reachability. Each of these patterns works generally across all variable features, instead of being I.
    [Show full text]
  • MC-1200 Series Linux Software User's Manual
    MC-1200 Series Linux Software User’s Manual Version 1.0, November 2020 www.moxa.com/product © 2020 Moxa Inc. All rights reserved. MC-1200 Series Linux Software User’s Manual The software described in this manual is furnished under a license agreement and may be used only in accordance with the terms of that agreement. Copyright Notice © 2020 Moxa Inc. All rights reserved. Trademarks The MOXA logo is a registered trademark of Moxa Inc. All other trademarks or registered marks in this manual belong to their respective manufacturers. Disclaimer Information in this document is subject to change without notice and does not represent a commitment on the part of Moxa. Moxa provides this document as is, without warranty of any kind, either expressed or implied, including, but not limited to, its particular purpose. Moxa reserves the right to make improvements and/or changes to this manual, or to the products and/or the programs described in this manual, at any time. Information provided in this manual is intended to be accurate and reliable. However, Moxa assumes no responsibility for its use, or for any infringements on the rights of third parties that may result from its use. This product might include unintentional technical or typographical errors. Changes are periodically made to the information herein to correct such errors, and these changes are incorporated into new editions of the publication. Technical Support Contact Information www.moxa.com/support Moxa Americas Moxa China (Shanghai office) Toll-free: 1-888-669-2872 Toll-free: 800-820-5036 Tel: +1-714-528-6777 Tel: +86-21-5258-9955 Fax: +1-714-528-6778 Fax: +86-21-5258-5505 Moxa Europe Moxa Asia-Pacific Tel: +49-89-3 70 03 99-0 Tel: +886-2-8919-1230 Fax: +49-89-3 70 03 99-99 Fax: +886-2-8919-1231 Moxa India Tel: +91-80-4172-9088 Fax: +91-80-4132-1045 Table of Contents 1.
    [Show full text]
  • Strings String Literals String Variables Warning!
    Strings String literals • Strings are not a built-in data type. char *name = "csc209h"; printf("This is a string literal\n"); • C provides almost no special means of defining or working with strings. • String literals are stored as character arrays, but • A string is an array of characters you can't change them. terminated with a “null character” ('\0') name[1] = 'c'; /* Error */ • The compiler reserves space for the number of characters in the string plus one to store the null character. 1 2 String Variables Warning! • arrays are used to store strings • Big difference between a string's length • strings are terminated by the null character ('\0') and size! (That's how we know a string's length.) – length is the number of non-null characters • Initializing strings: currently present in the string – char course[8] = "csc209h"; – size if the amount of memory allocated for – char course[8] = {'c','s','c',… – course is an array of characters storing the string – char *s = "csc209h"; • Eg., char s[10] = "abc"; – s is a pointer to a string literal – length of s = 3, size of s = 10 – ensure length+1 ≤ size! 3 4 String functions Copying a string • The library provides a bunch of string char *strncpy(char *dest, functions which you should use (most of the char *src, int size) time). – copy up to size bytes of the string pointed to by src in to dest. Returns a pointer to dest. $ man string – Do not use strcpy (buffer overflow problem!) • int strlen(char *str) – returns the length of the string. Remember that char str1[3]; the storage needed for a string is one plus its char str2[5] = "abcd"; length /*common error*/ strncpy(str1, str2, strlen(str2));/*wrong*/ 5 6 Concatenating strings Comparing strings char *strncat(char *s1, const char *s2, size_t n); int strcmp(const char *s1, const char *s2) – appends the contents of string s2 to the end of s1, and returns s1.
    [Show full text]
  • Implementation of the Programming Language Dino – a Case Study in Dynamic Language Performance
    Implementation of the Programming Language Dino – A Case Study in Dynamic Language Performance Vladimir N. Makarov Red Hat [email protected] Abstract design of the language, its type system and particular features such The article gives a brief overview of the current state of program- as multithreading, heterogeneous extensible arrays, array slices, ming language Dino in order to see where its stands between other associative tables, first-class functions, pattern-matching, as well dynamic programming languages. Then it describes the current im- as Dino’s unique approach to class inheritance via the ‘use’ class plementation, used tools and major implementation decisions in- composition operator. cluding how to implement a stable, portable and simple JIT com- The second part of the article describes Dino’s implementation. piler. We outline the overall structure of the Dino interpreter and just- We study the effect of major implementation decisions on the in-time compiler (JIT) and the design of the byte code and major performance of Dino on x86-64, AARCH64, and Powerpc64. In optimizations. We also describe implementation details such as brief, the performance of some model benchmark on x86-64 was the garbage collection system, the algorithms underlying Dino’s improved by 3.1 times after moving from a stack based virtual data structures, Dino’s built-in profiling system, and the various machine to a register-transfer architecture, a further 1.5 times by tools and libraries used in the implementation. Our goal is to give adding byte code combining, a further 2.3 times through the use an overview of the major implementation decisions involved in of JIT, and a further 4.4 times by performing type inference with a dynamic language, including how to implement a stable and byte code specialization, with a resulting overall performance im- portable JIT.
    [Show full text]
  • Red Hat Virtualization 4.4 Package Manifest
    Red Hat Virtualization 4.4 Package Manifest Package listing for Red Hat Virtualization 4.4 Last Updated: 2021-09-09 Red Hat Virtualization 4.4 Package Manifest Package listing for Red Hat Virtualization 4.4 Red Hat Virtualization Documentation Team Red Hat Customer Content Services [email protected] Legal Notice Copyright © 2021 Red Hat, Inc. The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/ . In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version. Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law. Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries. Linux ® is the registered trademark of Linus Torvalds in the United States and other countries. Java ® is a registered trademark of Oracle and/or its affiliates. XFS ® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries. MySQL ® is a registered trademark of MySQL AB in the United States, the European Union and other countries. Node.js ® is an official trademark of Joyent.
    [Show full text]
  • VSI Openvms C Language Reference Manual
    VSI OpenVMS C Language Reference Manual Document Number: DO-VIBHAA-008 Publication Date: May 2020 This document is the language reference manual for the VSI C language. Revision Update Information: This is a new manual. Operating System and Version: VSI OpenVMS I64 Version 8.4-1H1 VSI OpenVMS Alpha Version 8.4-2L1 Software Version: VSI C Version 7.4-1 for OpenVMS VMS Software, Inc., (VSI) Bolton, Massachusetts, USA C Language Reference Manual Copyright © 2020 VMS Software, Inc. (VSI), Bolton, Massachusetts, USA Legal Notice Confidential computer software. Valid license from VSI required for possession, use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license. The information contained herein is subject to change without notice. The only warranties for VSI products and services are set forth in the express warranty statements accompanying such products and services. Nothing herein should be construed as constituting an additional warranty. VSI shall not be liable for technical or editorial errors or omissions contained herein. HPE, HPE Integrity, HPE Alpha, and HPE Proliant are trademarks or registered trademarks of Hewlett Packard Enterprise. Intel, Itanium and IA64 are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. Java, the coffee cup logo, and all Java based marks are trademarks or registered trademarks of Oracle Corporation in the United States or other countries. Kerberos is a trademark of the Massachusetts Institute of Technology.
    [Show full text]
  • QED: the Edinburgh TREC-2003 Question Answering System
    QED: The Edinburgh TREC-2003 Question Answering System Jochen L. Leidner Johan Bos Tiphaine Dalmas James R. Curran Stephen Clark Colin J. Bannard Bonnie Webber Mark Steedman School of Informatics, University of Edinburgh 2 Buccleuch Place, Edinburgh, EH8 9LW, UK. [email protected] Abstract We also use additional state-of-the-art text processing tools, including maximum entropy taggers for POS tag- This report describes a new open-domain an- ging and named entity (NE) recognition. POS tags and swer retrieval system developed at the Uni- NE-tags are used during the construction of the semantic versity of Edinburgh and gives results for the representation. Section 2 describes each component of TREC-12 question answering track. Phrasal an- the system in detail. swers are identified by increasingly narrowing The main characteristics of the system architecture are down the search space from a large text col- the use of the Open Agent Architecture (OAA) and a par- lection to a single phrase. The system uses allel design which allows multiple questions to be an- document retrieval, query-based passage seg- swered simultaneously on a Beowulf cluster. The archi- mentation and ranking, semantic analysis from tecture is shown in Figure 1. a wide-coverage parser, and a unification-like matching procedure to extract potential an- 2 Component Description swers. A simple Web-based answer validation stage is also applied. The system is based on 2.1 Pre-processing and Indexing the Open Agent Architecture and has a paral- The ACQUAINT document collection which forms the ba- lel design so that multiple questions can be an- sis for TREC-2003 was pre-processed with a set of Perl swered simultaneously on a Beowulf cluster.
    [Show full text]
  • A Survey of Engineering of Formally Verified Software
    The version of record is available at: http://dx.doi.org/10.1561/2500000045 QED at Large: A Survey of Engineering of Formally Verified Software Talia Ringer Karl Palmskog University of Washington University of Texas at Austin [email protected] [email protected] Ilya Sergey Milos Gligoric Yale-NUS College University of Texas at Austin and [email protected] National University of Singapore [email protected] Zachary Tatlock University of Washington [email protected] arXiv:2003.06458v1 [cs.LO] 13 Mar 2020 Errata for the present version of this paper may be found online at https://proofengineering.org/qed_errata.html The version of record is available at: http://dx.doi.org/10.1561/2500000045 Contents 1 Introduction 103 1.1 Challenges at Scale . 104 1.2 Scope: Domain and Literature . 105 1.3 Overview . 106 1.4 Reading Guide . 106 2 Proof Engineering by Example 108 3 Why Proof Engineering Matters 111 3.1 Proof Engineering for Program Verification . 112 3.2 Proof Engineering for Other Domains . 117 3.3 Practical Impact . 124 4 Foundations and Trusted Bases 126 4.1 Proof Assistant Pre-History . 126 4.2 Proof Assistant Early History . 129 4.3 Proof Assistant Foundations . 130 4.4 Trusted Computing Bases of Proofs and Programs . 137 5 Between the Engineer and the Kernel: Languages and Automation 141 5.1 Styles of Automation . 142 5.2 Automation in Practice . 156 The version of record is available at: http://dx.doi.org/10.1561/2500000045 6 Proof Organization and Scalability 162 6.1 Property Specification and Encodings .
    [Show full text]
  • The UNIX Time- Sharing System
    1. Introduction There have been three versions of UNIX. The earliest version (circa 1969–70) ran on the Digital Equipment Cor- poration PDP-7 and -9 computers. The second version ran on the unprotected PDP-11/20 computer. This paper describes only the PDP-11/40 and /45 [l] system since it is The UNIX Time- more modern and many of the differences between it and older UNIX systems result from redesign of features found Sharing System to be deficient or lacking. Since PDP-11 UNIX became operational in February Dennis M. Ritchie and Ken Thompson 1971, about 40 installations have been put into service; they Bell Laboratories are generally smaller than the system described here. Most of them are engaged in applications such as the preparation and formatting of patent applications and other textual material, the collection and processing of trouble data from various switching machines within the Bell System, and recording and checking telephone service orders. Our own installation is used mainly for research in operating sys- tems, languages, computer networks, and other topics in computer science, and also for document preparation. UNIX is a general-purpose, multi-user, interactive Perhaps the most important achievement of UNIX is to operating system for the Digital Equipment Corpora- demonstrate that a powerful operating system for interac- tion PDP-11/40 and 11/45 computers. It offers a number tive use need not be expensive either in equipment or in of features seldom found even in larger operating sys- human effort: UNIX can run on hardware costing as little as tems, including: (1) a hierarchical file system incorpo- $40,000, and less than two man years were spent on the rating demountable volumes; (2) compatible file, device, main system software.
    [Show full text]