reflections of a wizard in training

Archive for the ‘Books’ Category

Do you know why we didn’t see any tigers or dragons in that movie? Because they were all crouching and hiding :-)

I’m currently taking a class on compilers. I tried taking it a couple years ago, but it was a bad idea: a data structures class should come before language translation, or else you fail miserably. I failed miserably. But this time, having taken data structures, programming languages and algorithms I feel much better about this class: for one thing, I know what I’m doing this time, for another – I like what I’m learning.

dragonbook.jpg

I’m writing a compiler for “Player”, a small imperative language with boolean, integer, real, and string values; arrays and records with implicit pointers; user-defined types; nested procedures; and a few simple control structures. It’s relatively small, yet not trivial. The book I’ve been using until recently was Appel’s “Modern Compiler Implementation in Java,” also known among my fellow students as “the tiger book” (it has a tiger on the cover). Two years ago this book left me with the feeling that my quest for knowledge is beyond hopeless – it would take me weeks to finish a chapter, and yet I wouldn’t understand half of it. Now that I know a lot more, I thought it would be different – but it’s not.

tigerbook.jpg

So I tried another book.

The lecture notes (provided on the course website) often refer to “the dragon book” - “Compilers” by Alfred V. Aho, Ravi Sethi and Jeffrey D. Ullman (with a dragon on the cover). My professor warned me that the book is a lot more detailed than what we need for this class. I tried it. More in-depth? Certainly. More complicated? Hell no! It does provide a very detailed analysis of each phase of the compiler-building process. However, these details build-up a very clear picture of how the compiler works.

I’m not even halfway through – I’ve just finished building a parser for the language. But I could’ve never built it relying on Appel’s book. I’ve been getting an impression that the “tiger book,” even when offering a detailed analysis, sort of jumps to conclusions; it’s like a bad derivation – it claims that A -> D without showing the intermediate steps: B -> C and C -> D. I may be wrong, but that’s exactly the impression I got from this book.

My vote is for the dragon book. Not only did it help me with this class (or should I say – it made the class assignments possible for me!); it also enabled me to take a step further and write my first parser-generator, and that’s way beyond anything I even understood a year ago. Thank you, Dragon Book!

contact me
blog
research
about