Introduction to Compiler Design

Introduction to Compiler Design is a textbook is intended for an introductory course on compiler design, suitable for use in an undergraduate programme in computer science or related fields.

The book presents techniques for making realistic, though non-optimising compilers for simple programming languages using methods that are close to those used in "real" compilers, albeit slightly simplified in places for presentation purposes. All phases required for translating a high-level language to machine language is covered, including lexing, parsing, intermediate-code generation, machine-code generation and register allocation. Interpretation is covered briefly.

The book aims to be neutral with respect to implementation languages, so algorithms are presented in pseudo-code rather than in any specific programming language, and suggestions for implementation in several different language flavours are in many cases given. The techniques are illustrated with examples and exercises.

The author has taught compiler design at the University of Copenhagen for over a decade, and the book is based on material used in the undergraduate compiler design course there.

Additional material for use with this book is available below. More material will be added later.

Publication details

Introduction to Compiler Design is published by Springer Verlag.

Read more at Springer Verlag's page.

Lecture slides

With thanks to Jost Berthold and Cosmin Oancea. A few slides refer to course-specific exercises.

Solutions to selected exercises


There is an overweight of solutions to exercises from Chapters 1--2. This might be remedied later.

Known misprints


Torben Mogensen
DIKU, University of Copenhagen, Universitetsparken 5, DK-2100 København Ø
Mobile phone: (+45) 21849672  Fax: (+45) 35321401