Books & Videos

Table of Contents

  1. Chapter 1 Lex and Yacc

    1. The Simplest Lex Program

    2. Recognizing Words with Lex

    3. Grammars

    4. The Parts of Speech Lexer

    5. Running Lex and Yacc

    6. Lex vs. Hand-written Lexers

    7. Exercises

  2. Chapter 2 Using Lex

    1. Regular Expressions

    2. A Word Counting Program

    3. Parsing a Command Line

    4. A C Source Code Analyzer

    5. Summary

    6. Exercises

  3. Chapter 3 Using Yacc

    1. Grammars

    2. Shift/Reduce Parsing

    3. A Yacc Parser

    4. The Lexer

    5. Arithmetic Expressions and Ambiguity

    6. Variables and Typed Tokens

    7. Symbol Tables

    8. Functions and Reserved Words

    9. Building Parsers with Make

    10. Summary

    11. Exercises

  4. Chapter 4 A Menu Generation Language

    1. Overview of the MGL

    2. Developing the MGL

    3. Building the MGL

    4. Screen Processing

    5. Termination

    6. Sample MGL Code

    7. Exercises

  5. Chapter 5 Parsing SQL

    1. A Quick Overview of SQL

    2. Three Ways to Use SQL

    3. The Syntax Checker

    4. The Parser

  6. Chapter 6 A Reference for Lex Specifications

    1. Structure of a Lex Specification

    2. BEGIN

    3. ECHO

    4. Input from Strings

    5. Internal Tables (%N Declarations)

    6. Line Numbers and yylineno

    7. Multiple Lexers in One Program

    8. output()

    9. Portability of Lex Lexers

    10. Regular Expression Syntax

    11. REJECT

    12. Returning Values from yylex()

    13. unput()

    14. yyinput(), yyoutput(), yyunput()

    15. yyleng

    16. yyless()

    17. yylex()

    18. yymore()

    19. yytext

    20. yywrap()

  7. Chapter 7 A Reference for Yacc Grammars

    1. Structure of a Yacc Grammar

    2. Actions

    3. Ambiguity and Conflicts

    4. Bugs in Yacc

    5. End Marker

    6. Error Token and Error Recovery

    7. %ident Declaration

    8. Inherited Attributes ($0)

    9. Lexical Feedback

    10. Literal Block

    11. Literal Tokens

    12. Portability of Yacc Parsers

    13. Precedence, Associativity, and Operator Declarations

    14. Recursive Rules

    15. Rules

    16. Special Characters

    17. Start Declaration

    18. Symbol Values

    19. Tokens

    20. %type Declaration

    21. %union Declaration

    22. Variant and Multiple Grammars

    23. y.output Files

    24. Yacc Library

    25. YYABORT

    26. YYACCEPT

    27. YYBACKUP

    28. yyclearin

    29. yydebug and YYDEBUG

    30. YYDEBUG

    31. yyerrok

    32. YYERROR

    33. yyerror()

    34. yyparse()

    35. YYRECOVERING()

  8. Chapter 8 Yacc Ambiguities and Conflicts

    1. The Pointer Model and Conflicts

    2. Common Examples of Conflicts

    3. IF—THEN—ELSE

    4. How Do I Fix the Conflict?

    5. IF—THEN—ELSE (Shift/Reduce)

    6. Summary

    7. Exercises

  9. Chapter 9 Error Reporting and Recovery

    1. Error Reporting

    2. Error Recovery

    3. Compiler Error Recovery

    4. Exercises

  1. Appendix AT&T Lex

    1. Error Messages

  2. Appendix AT&T Yacc

    1. Options

    2. Error Messages

  3. Appendix Berkeley Yacc

    1. Options

    2. Error Messages

  4. Appendix GNU Bison

    1. Differences

  5. Appendix Flex

    1. Flex Differences

    2. Options

    3. Error Messages

    4. Flex Versions of Lexer Examples

  6. Appendix MKS lex and yacc

    1. Differences

    2. New Features

  7. Appendix Abraxas lex and yacc

    1. Differences

    2. New Features

  8. Appendix POSIX lex and yacc

    1. Options

    2. Differences

  9. Appendix MGL Compiler Code

    1. MGL Yacc Source

    2. MGL Lex Source

    3. Supporting C Code

  10. Appendix SQL Parser Code

    1. Yacc Parser

    2. Cross-reference

  11. Appendix SQL Parser Code

    1. Lex Scanner

    2. Supporting Code

  12. Glossary

  13. Bibliography