Andy Keep - Writing a Nanopass Compiler

Channel:ClojureTV · Length:40:47 · Published:2014-01-06 · Views:28724

Watch on YouTube

Summary

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.

Why HN recommends it

Cited alongside compiler-construction resources as the go-to talk on the nanopass approach used in Chez Scheme.

Andrew Keep has a great talk on this approach [2]. — HN, 2018

Functional programming · Compilers, interpreters & program analysis

Subtitles (excerpt)

[Applause] thanks very much um so uh I'm Andy keep and following in my office mate will Bird's uh tradition I'm I'm not going to show any closure code today sorry but I will show some scheme code so uh so so I you know I wanted to start by saying I'm Andy keep and I love compilers I love writing compilers and doing things with compilers I just I think it's a lot of fun so I wanted to start out with a little bit of compiler history uh just to talk about what the idea of the nanopass stuff was and what the Genesis for it is um so we used to write compilers as just a a handful of passes uh for convenience here I've only represented three passes most of those compilers had more than that but not too many more than that and the early compilers were written this way because uh each individual pass had some work that it needed to do but there weren't enough resources on the machine to necessarily do that all in a single pass and in fact there wasn't even enough resources on the machine to store all this stuff in memory each pass would actually read in uh a representation of the program write it to the file system the next pass would read it in and write it to the file system and so you can see why they wanted to minimize the number of passes that they had in their

On Hacker News

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 co… — undecidabot, 2018-04
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 N… — LiamPowell, 2026-04
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, ye… — vengarioth, 2017-09
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. [VIDEO] [LINK] [LINK] — 616c, 2016-12

Related videos