
Modern compiler design
by Dick Grune · first published 2000
30mentions
12recommended by
20HN commenters
2008–2026first – last mentioned
60% recommend35% neutral5% critical
Why HN recommends it
Practical compiler textbook explaining how lexers, parsers, and code generation work without tying you to one language. Covers functional and logic language compilers; more approachable than the Dragon Book.
Summarised by Claude from recommending comments
Affiliate links. As an Amazon Associate I earn from qualifying purchases.







I had a hard time with Appel's _Modern Compiler Implementation in ML_ when I did the compiler course (7 years ago...) for my CS major. I much preferred _Modern Compiler Design_ by Dick Grune et al. (http://www.dickgrune.com/Books/MCD_1st_Edition/). A second edition seems to be in the pipeline (http://www.dickgrune.com/Books/MCD_2nd_Edition/).
…the instruction selection and instruction scheduling parts.) Other interesting texts in the area are: Michael Scott's excellent "Programming Language Pragmatics" and Grune, Bal, Jacobs and Langendoen's "Modern Compiler Design" (both of which have a nice treatment of functional and logic programming languages [the latter one being more comprehensive])
on “Want to Write a Compiler? Just Read These Two Papers.” ↗…techniques are not covered, runtime is treated much more briefly and many practical issues are not discussed at all. There are some nice modern textbooks that are more to the point: http://www.amazon.com/Modern-Compiler-Design-D-Grune/dp/0471... http://www.amazon.com/Engineering-Compiler-Second-Keith-Coop... ANTLR is a great tool and many practical issues I solved with the help of this book about it: http://www.amazon.com/gp/product/1934356999/…
on “Show HN: a lexer, parser, interpreter and web runtime (np, a 5-weekend project)” ↗For the actual implementation of a compiler (not design of the language itself), I'd recommend "Modern Compiler Design" by Dick Grune. A lot more practical and readable than the Dragon Book. About the language design itself, you might want to have a look to: http://www.drdobbs.com/architecture-and-design/so-you-want-t... These…
on “Ask HN: What are the best books on creating a programming language?” ↗Not sure if there are any books around LLVM or gcc, but there is a lot of up to date texts. Grune at al., "Modern Compiler Design", Appel, "Modern Compiler Implementation in ML", and many more. P.S. Because of a slow-ban, adding another one to this answer. This is the best source on SSA: http://www.cri.ensmp.fr/people/pop/papers/2006-12-thesis.pdf
on “How I wrote a self-hosting C compiler in 40 days” ↗…compiler construction, I would recommend these: - "The Basics of Compiler Design" by Torben Mogensen - "Modern Compiler Implementation in C" by Andrew Appel (ML and Java versions available too) - "Modern Compiler Design" by Grune, Bal et al. The Dragon Book is obviously infamous for this topic, but I would recommend covering at least two slightly more basic texts before taking it on.
on “Ask HN: What's the best computer science book you've read recently?” ↗I second "Modern Compiler Design" by Dick Grune. Without being bound to any language in particular, it gives you all the juicy details about how lex,yacc, LL(1) parses, recursive descent parsers etc really work really work, various backend/code…
on “Ask YC: Good compiler books?” ↗…and how they are implemented is here: http://www.ida.liu.se/~ulfni/lpp/ A more practical guide to actually compiling these logic programs efficiently (or as efficient as they can be) is documented in Modern Compiler Design by Dick Grune et al. They actually describe the workings of a somewhat simplified workings of a Warren Abstract Machine (WAM) which can (to my knowledge) now approach to within an order of magnitude of…
on “Not Lisp again....” ↗…available in recursive-descent parsers can be used for error recovery, e.g., phrase-level recovery. The excellent "Programming Language Pragmatics" by Michael Scott has a good chapter on this, so does "Modern Compiler Design" by Grune, Bal, Jacobs and Langendoen.
on “Yacc is dead” ↗…as the first go-to book, interested compiler programmers have to find supplemental material elsewhere. (I love M. Scott's "Programming Language Pragmatics", respect Grune, Bal, Jacobs and Langendoen's "Modern Compiler Design", consult Muchnick's "Advanced Compiler Design and Implementation".) Topic-wise, supplemental material to Wirth's CC-book, I suggest: LR-parsing (yacc) and in-depth study of instruction selection ([i]burg)…
on “Engineering a Compiler, 2nd Edition is out” ↗…- Aho, Hopcroft, Ullman: The Design and Analysis of Algorithms. - Wirth: Algorithms and Data Structures. * In Compilers: - Wirth: Compiler Construction. - Grune, Bal, Jacobs, Cerial: Modern Compiler Design. - Muchnick: Advanced Compiler Design and Implementation. * In Lambda calculus: - Barendregt: Introduction to Lambda Calculus. * In theoretical computer science: - Kozen: Automata and…
on “Technical Papers Every Programmer Should Read (At Least Twice)” ↗There is also a second edition, which updates some chapters with much more recent resulst (AFAIR, the book is from 1992.) In addtion, the author (Dick Grune) also co-authored a book on compilers ("Modern Compiler Design"), which I like a lot as it has a sound treatment of non-imperative programming language concepts, too. (Plus I think the treatment of BURS plus usage for instruction selection is best described therein…
on “Parsing Techniques - A Practical Guide” ↗I haven't read all of them. But I liked "Modern Compiler Design" (http://www.amazon.com/Modern-Compiler-Design-D-Grune/dp/0471...). If you have a functional bend, Simon Peyton Jones' book (https://research.microsoft.com/en-us/um/people/simonpj/Paper...) is worth…
on “C++ Grandmaster Certification” ↗Dick Grune - Modern Compiler Design
on “How I wrote a self-hosting C compiler in 40 days” ↗…Pieces - how to implement byte code compilers, macro systems, compilation to C, lots of good stuff here. (4) A book on lexing and parsing so you can give your language any syntax you want. I prefer Modern Compiler Design by Gries. If you understand the first three chapters you can write your own lex/yacc equivalents. (the book has a lot more to it than these chapters, but it is the best I've seen on lexing/parsing). (5)…
on “Create Your Own Programming Language (Book)” ↗