
Engineering a compiler
by Keith D. Cooper · first published 2004
54% recommend39% neutral7% critical
Why HN recommends it
Approachable, practical compiler text often suggested over the Dragon Book, balancing theory and practice, with strong back-end and optimization coverage; suits newcomers and working programmers.
Summarised by Claude from recommending comments
"The proliferation of processors, environments, and constraints on systems has cast compiler technology into a wider variety of settings, changing the compiler and compiler writer's role. No longer is execution speed the sole criterion for judging compiled code. Today, code might be judged on how small it is, how much power it consumes, how well it compresses, or how many page faults it generates. In this evolving environment, the task of building a successful compiler relies upon the compiler writer's ability to balance and blend algorithms, engineering insights, and careful planning. Today's
Affiliate links. As an Amazon Associate I earn from qualifying purchases.







…debate over the utility of the dragon book in the 21st century so many times on HN that I'm not going to comment on it's usefulness. (Search if interested) But, for those interested, I highly recommend Engineering a Compiler by Cooper and Torczon OR Modern Compiler Implementation in ML by Appel. I've read all three and would only recommend the dragon book to someone very interested in the subject.
on “An Intro to Compilers” ↗…simply control flow edges in the CFG). For a (relatively) approachable set of materials on the subject, see: http://www.cs.rice.edu/~keith/512/2011/Lectures. I also highly recommend Cooper & Torczon's "Engineering a Compiler" (2d Ed.) In a world of CS researchers that can't write an English sentence to save their lives, Keith Cooper and Linda Torczon's work is a paragon of clear prose. (Their lab at Rice is where Cliff Click…
on “How JavaScript compilers work” ↗The following that I have on my bookshelf have helped: Compilers Second Edition [0] Engineering a Compiler, Second Edition [1] Computer Systems: A Programmer's Perspective (3rd Edition) [2] [0]https://www.amazon.com/Compilers-Principles-Techniques-Alfre... [1]https://www.amazon.com/Engineering-Compiler-Second-Keith-Coo... [2]https://www.amazon.com/Computer-Systems-Programmers-Perspect...
on “Ask HN: Resources for learning to write compilers?” ↗"Engineering a Compiler" by Cooper and Torczon The Dragon Book is not the best book these days, it focuses too much on stuff you won't care about and not enough on the stuff you do care about. (e.g. it focuses a lot on parser…
on “Ask YC: Good compiler books?” ↗My three favorite books on compilers (in no particular order) are: * Engineering a Compiler: https://www.amazon.com/Engineering-Compiler-Second-Keith-Coo... * Modern Compiler Implementation in ML: https://www.cs.princeton.edu/~appel/modern/ml/ * Compiling with Continuations: https://www.amazon.com/Compiling-Continuations-Andrew-W-Appe...
on “Programming books you might want to consider reading” ↗Compilers books: I'd start with "Engineering a Compiler" by Keith Cooper and Linda Torczon. http://craftinginterpreters.com/ is also a pretty great, programming-oriented intro, which may be good to work through alongside. For more on the analysis & compiler…
on “Advanced Compilers: Self-Guided Online Course” ↗Essentials of Programming Languages. Engineering a Compiler. Managing Gigabytes. Advanced Programming in the Unix Environment Unix Network Programming On Lisp Advanced Compiler Design and Implementation Concepts, Techniques and Models of Computer Programming…
on “Ask HN: What are your favorite programming books?” ↗The implementation of functional programming languages by Peyton-Jones. Engineering a compiler by Cooper and Torczon.
on “Ask HN: What are the best books on creating a programming language?” ↗Engineering a Compiler 2nd edition, by Keith D. Cooper and Linda Torczon The dragon books are better used as references to those who are already familiar with all of the high-level concepts in compiler writing.
on “How I wrote a self-hosting C compiler in 40 days” ↗…repetition reading through it, but I find it to be pretty easier to read/understand. https://github.com/golang/go/tree/release-branch.go1.6/src/g... Also, I have read (at least parts of) the book, "Engineering a Compiler", which being a novice in the subject, some of it goes over my head, but I think it does a better job outlining the topic than any other books I have read. https://www.amazon.com/Engineering-Compiler-Second-Keith-Coo...…
on “Show HN: Writing my first interpreter in C for fun” ↗The book "Engineering a Compiler" (https://www.amazon.com/Engineering-Compiler-Second-Keith-Coo...) is a good resource and reference; I keep it on my desk at work. Like other compiler books, it falls short in meeting all practical application…
on “Ask HN: Best book about compilers?” ↗Engineering a Compiler 2nd Edition by Keith D. Cooper and Linda Torczon is highly regarded.
on “Go is about to get faster” ↗The authors of these slides also wrote a well-regarded textbook, Engineering a Compiler.
on “Fortran H and PL.8: Papers about Great Optimizing Compilers [pdf]” ↗For a classic CS view around the year 2000: * Concepts, Techniques, and Models of Computer Programming * Engineering a Compiler * The Elements of Computing Systems
on “Old timers, what did you read to study Unix or languages by the book?” ↗…focused on the kind of theory you need to build tools like lex and yacc, rather than stuff you need to know if you want to write a compiler. For a good intro of modern back end development, check out Engineering a Compiler. It's also got the lexical and parsing end of things, but a bit better done, but still quite theoretical. One of the best books I read on programming is "Concepts, Techniques, and Models of Computer…
on “Ask HN: What language-agnostic programming books should I read?” ↗