Introduction to Compiler Construction with UNIX

Axel T. Schreiner, H. George Friedman, Jr.

Publisher: Prentice Hall, 1985, 194 pages

ISBN: 0-13-474396-2

Keywords: Programming

Last modified: April 30, 2016, 6:13 p.m.

The authors designed this practical book as a case study of two powerful, yet easy-to-use tools in the UNIX system. They show you how to create a compiler using generators such as yacc (LALR(1) parser generator) and lex (regular expression-based lexical analyzer generator).

SampleC, a simple subset of C, is defined and used as an example of compiler development. The implementation is intended to produce less than optimal object code, and suggestions for improvements to the code and extensions to the language provide problems in several chapters.

This tutorial shows how to get a simple, easily modifiable implementation quickly and reliably. It also helps the reader to learn practical details of the components of a compiler and the interfaces between them. The book is a short exposition preceding detailed algorithm studies in compiler construction and offers a description of how to employ productively the generators described.

  • Introduction
  1. Language Definition
    1. Purpose
    2. Mechanical aspects
    3. Convenient grammars
    4. Checking a grammar
    5. Common pitfalls
    6. Example
    7. A note on typography
    8. Problems
  2. Word Recognition
    1. Purpose
    2. Definition tools
    3. Patterns
    4. Ambiguity as a virtue
    5. "lex" programs
    6. Testing a lexical analyzer
    7. Example
    8. Problems
  3. Language Recognition
    1. Parser generation
    2. Example
    3. Auxiliary functions
    4. Debugging the parser
    5. User-defined terminal symbols
    6. Typing the value stack
    7. Example
    8. Problems
  4. Error Recovery
    1. The problem
    2. Basic techniques
    3. Adding the error symbols
    4. Adding the yyerrok actions
    5. Example
    6. Problems
  5. Semantic Restrictions
    1. The problem
    2. Symbol table principles
    3. Example
    4. Typing the value stack
    5. Problems
  6. Memory Allocation
    1. 6.1 Principles
    2. 6.2 Example
    3. 6.3 Problems
  7. Code Generation
    1. Principles
    2. Example
    3. Problems
  8. A Load-and-Go System
    1. A machine simulator
    2. In-core code generation
    3. Example
    4. Problems
    5. Projects
  1. "sampleC" Compiler Listing
    1. Syntax analysis
    2. Lexical analysis
    3. Messages
    4. Symbol table routines
    5. Memory allocation
    6. Code generation
    7. A load-and-go system
    8. Improved error messages from yaccpar
    9. Improved debugging output from yaccpar
    10. Regression testing

Reviews

Introduction to Compiler Construction with UNIX

Reviewed by Roland Buresund

Disappointing *** (3 out of 10)

Last modified: April 30, 2016, 5:44 p.m.

One of the reasons UNIX got popular was the ease with which you could create new languages with the help of lex and yacc.

Unfortunately, this is not a very good book. Avoid it.

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required

captcha

required