Want to Write a Compiler? Just Read These Two Papers (2008)

It has been reported that a 2008 prog21 post, picked up again on Hacker News, makes a blunt argument: most compiler books teach you everything except how to actually ship a compiler. Dense chapters on grammars and automata. Beautiful theory. But how do you get to working code? The post — and the resources it champions — aim to close that gap.
The problem: theory vs. craft
Textbooks like the venerable "Dragon Book" are indispensable, yet they can feel like reading an encyclopedia when what you need is a how-to. It has been reported that this opaqueness helped create the myth that compilers are intrinsically arcane. Are they? Not if you start small. Jack Crenshaw’s "Let’s Build a Compiler!" series is the counterpunch: simple, single-pass compilers in the Turbo Pascal tradition, clear steps, and code you can run and modify in an afternoon. It strips away the ritual and shows you the plumbing.
The prescription: nanopasses and trees
The other half of the essay points at "A Nanopass Framework for Compiler Education" by Sarkar, Waddell, and Dybvig. The pitch is elegant: model compilation as lots of tiny, well-defined transformations on an internal representation. Don’t cram ten changes into one beastly pass — make many small, testable passes. Crenshaw’s tutorials skip abstract syntax trees for simplicity; nanopass embraces them. And in modern, dynamic or functional languages — Python, Ruby, Lisp, Haskell, Erlang — building and manipulating trees is trivial, which makes these approaches especially practical today.
So what should a curious programmer do? Start with Crenshaw to learn the mechanics, read the Nanopass paper to learn the architecture, and then — if you still want theoretical depth — graduate to the Dragon Book. The post’s author, James Hague, signs off as a long-time game dev who argues that compiler mastery is about implementing ideas, not worshipping complexity. It’s a hopeful message: compilers don’t have to be mystic; they can be taught, built, and enjoyed.
Sources: dadgum.com, Hacker News
Comments