Home
DS
Compiler page


Reading N. Wirth's "Compilerbau"


Motivation

I've chosen Wirth's "Compilerbau" to start learning about compilers.
Compared to the frequently used "Dragon Book" it is a very concise
introductory text.  On little more than one hundred pages Wirth
explains formal languages, parsing, error handling, virtual machines,
code generation, processes and how to port a compiler, implementations
mostly included.

A few unanimous reviewers highly acclaim the book on the site of a
well-known on-line book store and recommend it for beginners.  After
reading ch. 1 - 11 I fully agree but would also note a few things.
The introduction to formal languages is really minimal and leaves some
questions open which are clarified only partially in the rest of the
text.  This is okay because it is enough to get you off the ground.

"Compilerbau" is a german text.  The full citation is:
N. Wirth (1986): "Compilerbau", 4. ed., Teubner, Stuttgart.

But just reading this book is not enough.  Beginners must also read
and understand the code which means to familiarize themselves with
Modula-2, which is not too hard as on-line grammars are available.  An
excellent way to make sure one understands everything is to translate
the programs into one's preferred language.  The explanations that
accompany the code are sometimes very concise and just prepare the
active study of the code.  This is also okay because the code is of
very high quality.  So this book is a recommendable first book on
compilers.

In what follows I summarize my way through the matter which of course
is determined by my previous knowledge (or lack thereof) and my
interests.  I translate the important parts of Wirth's Modula-2 code
into Python and also got inspired to realize two more or less
independent coding projects in Python and C.  The summary pretty much
documents my progress through the text and as such also presents my
problems and solutions concerning certain topics.

If you are going to read on, be warned.  Wirth's book is already
short, concise, dense.  My summary is even shorter.  If you don't
understand the book, the summary will probably be of little help, well
maybe yes on some occasions.  Also, the summary may contain errors and
there are still some places marked with [[double brackets]] that need
editing.

Menu:

Chapters 0 - 2
Chapter 3 and a little exercise
Chapters 4 - 5
Chapter 6 and a little exercise
Chapter 7 and an idea for a little exercise
Chapters 8 - 11
Chapters 12 - 13 (omitted)

---
ds, 20101009.