Nanopass Compiler Framework

While not directly related to PL theory, I consider compiler construction a close relative. This set of papers describes Indiana University's compiler coursework. The key to these papers is "very small source-to-source transformations", remaining executable between passes for pedagogy and verification. Scheme is used as the source and target language because its s-expression syntax requires no 'marshaling' to and from human-readable syntax and AST structures. Later stages of the compiler include annotations directly in the source as quoted, unevaluated lists.

There is also a Summer Scheme Workshop (with complete compiler code) demonstrating some of these ideas. If anyone finds code for the Nanopass or Micropass compiler, please let me know. I'm interested in studying them as well.

A compiler structured as a small number of monolithic passes is difficult to understand and difficult to maintain. ... An attractive alternative is to structure a compiler as a collection of many fine-grained passes, each of which performs a single task. This structure aligns the implementation of a compiler with its logical organization, simplifying development, testing, and debugging.

[1] Compiler Construction Using Scheme Hilsdale, Ashley, Dybvig, and Friedman.
[2] Compiling: A high-level introduction using Scheme Haynes
[3] A Nanopass Framework for Compiler Education Sarkar, Waddell, Dybvig

[4] Destination Driven Code Generation
[5] Summer Scheme Workshop; Compiling Scheme

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Looks interesting. Thanks.

Looks interesting. Thanks.

The Scheme Compiler Workshop

The compiler code from the Scheme compiler workshop is worth a read - as is the paper "Destination Driven Code Generation", which explains the code generation strategy used.

The compiler produces Sparc machine code, and since not everyone has a Sparc, a Sparc emulator written in Scheme is included!