Basics of Compiler Design

I have taught an undergraduate compilers course for over a decade. In the last several years, I have used my own textbook "Basics of Compiler Design". I have now decided to make this available online.

Permission to copy and print for personal use is granted. If you, as a lecturer, want to print the book and sell it to your students, you can do so if you only charge the printing cost. If you want to print the book and sell it at profit, please contact me and we will find a suitable arrangement.

Differences between editions

Each new edition has fixed errors and rephrased some explanations. Additionally, the 2008 edition added a chapter about analysis and optimisation, and the 2009 edition added a short chapter about interpretation and is typeset in a slightly heavier font.


book cover

How to get Basics of Compiler Design

You have two options: You can download the book directly from this page by clicking on "Get the book" below, or you can go to Lulu.com, where you get the option of downloading the book or ordering a perfect-bound paper copy. The contents are the same in all versions (except that you get a nice cover for the paper copy).

The cover picture (shown left) is taken outside DIKU.

Both versions use 156 × 234 mm paper format[1].


Get the book


View table of contents


Solutions to selected exercises


Known misprints

If you should find more misprints or other errors, please report these to me.


[1]Lulu.com calls this paper size "Royal", but that doesn't seem to fit the Wikipedia definition of paper sizes.


Torben Mogensen
DIKU, University of Copenhagen, Universitetsparken 1, DK-2100 København Ø
E-mail: torbenm@diku.dk Telephone: (+45) 35 32 14 04 Fax: (+45) 35 32 14 01