Modern Compiler Design, First Edition
(There is a Second Edition! See below or click here!)


Dick Grune, Henri E. Bal, Ceriel J.H. Jacobs, and Koen G. Langendoen,

VU University Amsterdam, Amsterdam, The Netherlands

John Wiley & Sons, Ltd., pp. 736 + xviii, 2000; ISBN 0 471 97697 0

French translation, titled Compilateurs, published by Dunod, pp. 774 + xxi, 2002; ISBN 2 10 005887 8.

Spanish translation, titled Diseño de compiladores modernos, published by McGraw-Hill, pp. 752+, 2007; ISBN 8 44 815656 0.

Brazilian/Portugese translation, titled 'Projeto Moderno De Compiladores - Implementaçao E Aplicaçoes', published by Campus, pp. 752, ISBN 8 53 520876 3.

Description

The book is intended for students who have at least used a compiler and have given some thought to the notion of compilation. It is not an introductory course (although it explains almost everything from basics).

The book consists conceptually of two parts. The first part covers the general compilation process, and contains three chapters based on the analysis/processing/synthesis paradigm: text analysis, context handling and code generation. The second part consists of four chapters, covering the paradigm-specific problems of imperative and object-oriented, functional, logic and parallel and distributed programs. The two parts are separated by a chapter on memory management/garbage collection.

We, the authors, have tried hard to write the book in an intuitively appealing style, concentrating on the reasoning behind and the mechanics of the algorithms rather than emphasizing rigorous formulation and formal correctness proofs.

Although the book covers most of the traditional techniques, it makes a number of strong philosophical and perhaps controversial statements, for which we think the time has come:

  • It recognizes lexical analysis, LR parsing and BURS code generation as instances of bottom-up pattern matching and explains them uniformly using dotted items, thus unifying three important techniques in compiler design, and allowing the students to extend them to fit their needs.
  • A recurrent theme is `precomputation': first a simple, understandable, and obviously correct technique is designed, then all computation that can be done at compiler generation time is performed there. This leads naturally from interpretive lexical analysis to FSAs and allows us to view generated code as an instantiation of an interpreter, thus introducing connections with partial evaluation.
  • It emphasizes closure algorithms wherever possible, thus unifying many seemingly different algorithms.
  • It places compiler construction in a wider frame of file and data conversion, thus enabling the student to see applicability in other programming domains.

The top level structure of the book is:

  • Introduction
  • 
    
  • From Program Text to Abstract Syntax Tree
  • Annotating the Abstract Syntax Tree - The Context
  • Processing the Intermediate Code
  • 
    
  • Memory Management
  • 
    
  • Imperative and Object-Oriented Programs
  • Functional Programs
  • Logic Programs
  • Parallel and Distributed Programs
  • 
    
  • Bibliography
  • Answers to Exercises

For more information, see the Preface (in PostScript or or in PDF), the Table of Contents (in PostScript or or in PDF), and the Index (in Postscript or or in PDF).

Course Material

All figures and tables in the book are available for the preparation of overhead sheets or slides, to be used in the classroom or otherwise. There are two versions, one with one diagram per page (561 pages) (in PostScript or in PDF), and one with several diagrams per page (245 pages) (in PostScript or in PDF).

More answers to exercises (in PostScript or in PDF) than provided in the book are also available.

The code of the examples in the book, runnable under UNIX + look-alikes and MSDOS, can be downloaded by clicking here for a tar version or here for a zip version.

Click here to obtain an errata sheet.

Purchasing

Visit the US Amazon.com page, the European Amazon.com page, the German Amazon.com page, or your bookshop.

There is a French translation, titled Compilateurs, published by Dunod, ISBN 2-10-005887-8.

New Second Edition!

August 7, 2012. The Second Edition, published by Springer, is now available from their Web site: click here. New features in this new edition are: Techniques for embedded systems (object code size reduction, reducing power consumption, memory allocation); Generalized (non-deterministic) LR parsing, freeing the compiler writer from the limitations of LALR; Legacy code (grammar recovery; disassembly and/or decompilation of legacy binary code); More optimization techniques (procedural abstraction, binary code rewriting, optimal code generation through exhaustive search, tail recursion removal). In addition the text of the first edition has been expanded, updated, and restructured, greatly increasing the number of chapters.

About the authors

Dick Grune teaches principles of programming languages and compiler construction. He was involved in constructing Algol 68 compilers in the 1970s and participated in the Amsterdam Compiler Kit in the 1980s. He is co-author of two other books: Programming Language Essentials and Parsing Techniques - A Practical Guide .

Henri Bal presently heads the Orca group, doing research on parallel and distributed programming. He has more than 20 years of experience in compiler construction and is a recipient of the prestigious "Pionier" Award of NWO (Dutch Organization for Scientific Research). He is the author of more than 60 articles and (co-)author of two other books: Programming Language Essentials and Programming Distributed Systems .

Ceriel Jacobs has been working in compiler construction on a full-time basis since the beginning of the 1980s. In the 1980s he was in charge of the Amsterdam Compiler Kit, he wrote the compiler for the Orca parallel programming system, and is now involved in the Manta project, which includes a native Java compiler. He is also coauthor of the book Parsing Techniques - A Practical Guide .

Koen Langendoen has been working in compiler construction since around 1985, and is specialized in code generation. He has written compiler backends and runtime support systems for imperative languages (the Amsterdam Compiler Kit), functional languages (the FAST/FCG compiler) and parallel languages (the Orca compiler).


[Dick Grune] [Henri Bal] [Ceriel Jacobs] [Koen Langendoen] [John Wiley & Sons, Ltd.]
Modern Compiler Design / Dick Grune / dick@dickgrune.com