Andy Keep - Writing a Nanopass Compiler
Why Hacker News recommends it
Cited alongside compiler-construction resources as the go-to talk on the nanopass approach used in Chez Scheme.
What it is
Andy Keep's Clojure/Conj talk on writing a nanopass compiler, built from many single-task passes with formally defined intermediate languages. It covers the framework's origins in a compiler teaching course at Indiana University.
Recommended by 1 HN commenters across 1 different months, 2016 to 2026.
What Hacker News said
Recommends undecidabot · 2018-04 · on “MLton Compiler Overview”
Compilers come in all shapes and sizes. Some are single pass like Turbo Pascal. They directly generate machine code while parsing (no AST!). Niklaus Wirth (Pascal/Modula/Oberon guy) wrote a book following this approach [1]. Some have multiple passes like Chez Scheme. They have many simple passes, which they call a "nanopass". Andrew Keep has a great talk on this approach [2]. In practice, most compilers today are multi-pass, though probably not as many Chez. If we look at Rust, they go from AST -> HIR -> MIR -> LLVM IR -> machine code [3]. There are probably more things going on from LLVM to machine code, but I'm not knowledgeable enough to comment on it. I think the trade-off here is clear:
Cites 616c · 2016-12 · on “An Incremental Approach to Compiler Construction (2006) [pdf]”
Is this preceding work to the tour de force that is the Chez Scheme incremental like 40+ Scheme compiler. I mean, Cisco bought it, probably to hide it from us all. It must be worth something. [this video] [LINK] [LINK]
Cites vengarioth · 2017-09 · on “Ask HN: Resources for building a programming language?”
Many suggest resources for compiler implementations, i personally would start prototyping the language itself, think about it's type system and its runtime properties. There are many possibilities in terms of type systems, from static to dynamic and everything in between, concepts like linear types, algebraic types, etc. Runtime properties are things like it's memory model (garbage collection, yes or no). All of this depends on the purpose of your language. The second part would be choosing a platform to run on (so you only have to write a compiler frontend). There are many great technologies to host a language, but i'd advocate two specific ones here: * [LINK] (shoutout to @love2code) * [LI
Cites LiamPowell · 2026-04 · on “Want to Write a Compiler? Just Read These Two Papers (2008)”
See also, Andy Keep's dissertation [1] and his talk at Clojure/Conj 2013 [2]. I think that the nanopass architecture is especially well suited for compilers implemented by LLMs as they're excellent at performing small and well defined pieces of work. I'd love to see Anthropic try their C compiler experiment again but with a Nanopass framework to build on. I've recently been looking in to adding Nanopass support to Langkit, which would allow for writing a Nanopass compiler in Ada, Java, Python, or a few other languages [3]. [1]: [LINK] [2]: [this video] [3]: [LINK]