Book description
This book shows you how to use two Unix utilities, lex andyacc, in program development. These tools help programmers build compilers and interpreters, but they also have a wider range of applications.The second edition contains completely revised tutorial sections for novice users and reference sections for advanced users. This edition is twice the size of the first and has an expanded index.The following material has been added:
- Each utility is explained in a chapter that covers basic usage and simple, stand-alone applications
- How to implement a full SQL grammar, with full sample code
- Major MS-DOS and Unix versions of lex and yacc are explored in depth, including AT&T lex and yacc, Berkeley yacc, Berkeley/GNU Flex, GNU Bison, MKS lex andyacc, and Abraxas PCYACC
Publisher resources
Table of contents
- lex & yacc, 2nd Edition
- A Note Regarding Supplemental Files
- Preface
- 1. Lex and Yacc
- 2. Using Lex
- 3. Using Yacc
- 4. A Menu Generation Language
- 5. Parsing SQL
-
6. A Reference for Lex Specifications
- Structure of a Lex Specification
- BEGIN
- ECHO
- Input from Strings
- Internal Tables (%N Declarations)
- Line Numbers and yylineno
- Multiple Lexers in One Program
- output()
- Portability of Lex Lexers
- Regular Expression Syntax
- REJECT
- Returning Values from yylex()
- unput()
- yyinput(), yyoutput(), yyunput()
- yyleng
- yyless()
- yylex()
- yymore()
- yytext
- yywrap()
-
7. A Reference for Yacc Grammars
- Structure of a Yacc Grammar
- Actions
- Ambiguity and Conflicts
- Bugs in Yacc
- End Marker
- Error Token and Error Recovery
- %ident Declaration
- Inherited Attributes ($0)
- Lexical Feedback
- Literal Block
- Literal Tokens
- Portability of Yacc Parsers
- Precedence, Associativity, and Operator Declarations
- Recursive Rules
- Rules
- Special Characters
- Start Declaration
- Symbol Values
- Tokens
- %type Declaration
- %union Declaration
- Variant and Multiple Grammars
- y.output Files
- Yacc Library
- YYABORT
- YYACCEPT
- YYBACKUP
- yyclearin
- yydebug and YYDEBUG
- YYDEBUG
- yyerrok
- YYERROR
- yyerror()
- yyparse()
- YYRECOVERING()
- 8. Yacc Ambiguities and Conflicts
- 9. Error Reporting and Recovery
- A. AT&T Lex
- B. AT&T Yacc
- C. Berkeley Yacc
- D. GNU Bison
- E. Flex
- F. MKS lex and yacc
- G. Abraxas lex and yacc
- H. POSIX lex and yacc
- I. MGL Compiler Code
- J. SQL Parser Code
- K. SQL Parser Code
- Glossary
-
Bibliography
- Index
- About the Authors
- Copyright
Product information
- Title: lex & yacc, 2nd Edition
- Author(s):
- Release date: October 1992
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781565920002
You might also like
book
Essential Algorithms, 2nd Edition
A friendly introduction to the most useful algorithms written in simple, intuitive English The revised and …
book
The Art of Assembly Language, 2nd Edition
Assembly is a low-level programming language that's one step above a computer's native machine language. Although …
book
Compilers: Principles and Practice
Compilers: Principles and Practice explains the phases and implementation of compilers and interpreters, using a large …
book
C++ Templates: The Complete Guide, 2nd Edition
Templates are among the most powerful features of C++, but they remain misunderstood and underutilized, even …