Compiler Writing Made Easy

by Charles G. Petersen

Preface

Chapter 1 Introduction
  Preview
  Assemblers
  Compilers
    Introduction
    Scanner
    Parser
    Semantic Unit
    Optimizer
    Code Generator
  Interpreters
  Review
  Key Terms

Chapter 2 General background information
  Preview
  Grammars and languages
  Derivation
  Extended BNF
  Syntax diagrams
  Grammar classifications
  "How to" section
    Getting started
    SubAda
    Connected and grounded
  Review
  Key Terms

Chapter 3 Scanner
  Preview
  Regular grammars
  Regular expressions
  Finite-state automaton
  NDFSA to DFSA
  Lexeme scanner
  Get_character procedure
  Symbol table
    Simple objects
    Composite types
    Subprogram nesting levels
  "How to" section
    Finite-state scanner
    Divide-and-conquer scanner
    Use of the software
  Review
  Key Terms

Chapter 4 Parsers
  Preview
  Context-free grammars
  Push-down automaton
  LL(1) grammars
    Introduction
    Selection sets
    Selection set generation
    General parsing algorithm
    Table driven parser
    Recursive descent parset
  LR(1) grammars
    SLR(1) grammars
      Introduction
      Generating SLR(1) parsing tables
      Using SLR(1) parsing tables
      Conflicts
    LALR(1) grammars
      Generating LALR(1) parsing tables
      Using LALR(1) parsing tables
    Improved LR(1) parsing algorithm
  Comparing parsing methods
    Disadvantages of LL(1)
    Disadvantages of LR(1)
    Advantages of LL(1)
    Advantages of LR(1)
  "How to" section
    Parse generator
    Selection set generation
    LL(1) parse table generation
    Recursive descent parser
    SLR(1) parse table generation
    LALR(1) parse table generation
  Review
  Key Terms

Chapter 5 Code generation
  Preview
  Introduction
  Expressions
    Infix
    Prefix
    Postfix
    Quadruples
  Syntax-directed translation
    Expressions
    Declarations
    Simple statements
    Control structures
      Simple sequence construct
      Selection construct
      Repetition construct
      Subprograms
  "How to" section
    Action routines in BNF
    LL(1) example
    Action algorithm
    LR(1) example
  Review
  Key Terms

Chapter 6 Interpreter
  Preview
  Hardware
  Software
  Memory management
  Interpreting Quadruples
    Expression
    Assignment
    Input-output
    Test and branch
  "How to" section
  Review
  Key Terms

Chapter 7 Error processing
  Preview
  Introduction
  Detecting errors
    Detecting lexical errors
    Detecting syntax errors
    Detecting semantic errors
    Detecting run-time errors
  Reporting errors
    Reporting lexical errors
    Reporting syntax errors
      LL(1) error reporting
      LR(1) error reporting
    Reporting semantic errors
    Reporting run-time errors
  Error recovery
    Lexical error recovery
    Syntax error recovery
      LL(1) error recovery
      LR(1) error recovery
    Semantic error recovery
    Run-time error recovery
  Error correction
  "How to" section
    Syntax error reporting
      LL(1) syntax error reporting
      LR(1) syntax error reporting
    Syntax error recovery
      LL(1) syntax error recovery
      LR(1) syntax error recovery
  Review
  Key Terms

Chapter 8 Optimization
  Preview
  Introduction
  Optimizer terminology
    Common subexpression elimination
    Copy propagation
    Constant folding
    Code motion
  Optimization example
    Basic blocks
    Reduced copies
    Elimination of common subexpressions
    Reduce temporaries
    Branch and no-operation reduction
    Remove empty quadruples
    Comparisons
  Review
  Key Terms

Index