TRECENTESIMO QUINTO
VITAE POUYAE


Building a 43-pass compiler in fifteen weeks was feasible because P523 used the “nanopass” approach to compiler development, in which one structures a compiler as a series of many small passes, each with a well-defined input and output language.
With a parser combinator library, you write a parser by starting with a bunch of primitive parsers (say, that parse numbers or characters) and combining them, eventually building up the ability to parse a sophisticated language. The language one can parse gets fancier and fancier, but at every step of the way, the thing one has is a parser. Likewise, when developing a compiler, it’s useful to be able to think of the thing that you have at each stage of the process as already being a compiler; as you go along, it becomes a compiler for a language that’s increasingly different from the target language.
Interestingly, the nanopass work was originally not intended to be specifically for education, but the ICFP reviewers required that the authors position it that way in the paper out of concern that a nanopass-style compiler would not be efficient enough for actual production use. Nine years later, Andy Keep and Dybvig documented this bit of history (and refuted the efficiency concern) in their ICFP ’13 paper “A Nanopass Framework for Commercial Compiler Development”, which describes their rewrite of the Chez Scheme compiler using the nanopass approach. Chez Scheme itself was open-sourced in 2016 and, excitingly, is now the foundation of Racket.