The first edition of the Compilers: Principles, Techniques, and Tools textbook is popularly known as the red dragon book. This was the compilers textbook I had back in my undergrad. Though this book by Aho, Sethi and Ullman is famous, I do not particularly remember enjoying studying this book in my undergrad. I recently decided to go back and give it another try. Though a second edition was released in 2006, known as the purple dragon book, I decided to stick to the 1986 first edition. At 700+ pages, this book took me a few weeks just to quickly browse through and study whatever I found interesting.
Some of the topics the book covers include:
Lexical analysis: Conversion of source code into tokens. NFA, DFA and how to convert NFA to DFA. Regular expressions and how to match regex using NFA or DFA.
Syntax analysis: CFG and tree constructs to parse tokens from the lexical analyzer.
Call stacks, caller and calle calling conventions. Stack and heap allocation methods. Call by value, call by reference and other ways of passing inputs to methods. Symbol tables.
Code generation: 3-address code as intermediate language. Basic blocks and basic block optimizations. Peephole optimizations and register allocation methods.
Code optimization: Loop optimization, code motion, induction variable elimination, reduction in strength.
There is a lot more in the book, but I either skipped over it because I was not interested or just found it difficult to learn. A big problem with this book is that it is theoretical, every chapter feels exactly like reading a survey paper in the field of compilers. All possible methods and data structures are presented, making this not a suitable book for instruction.
What I liked about the book is that it has lots of illustrative examples and lots of figures. It talks about lots of old-timey languages like C, Fortran, and Pascal and old computers, and brings in a lot of language and compiler history. I always relish knowing the history and context in which new inventions were made.
In the final conclusion, I must say that despite all the juicy details of old languages, OSes, tools and computers, the book is still weighed down by not having a clear instructive direction and by its focus on theory.
Rating: 3/4