The Visible Compiler

The goal of this project was to provide an easy, visual way of understanding the middle end of the Scheme compiler. This part of the compiler uses an internal language called KMP Scheme, which has a call-lookup syntax. The compiler makes several passes through the code, changing its copy of the KMP Scheme at each pass.

Since compiled code can be difficult to read, it can be hard to figure out what the compiler is doing at each phase. This project enables users to view the output of a phase in any Web browser, with the changes made by that phase highlighted. The highlighted pieces of the code are links to brief explanations of how and why that code was changed by the compiler. Thus the effects of a particular phase of the compiler are isolated and explained, saving the need to hunt through large amounts of code.

The project is able to provide additional insight into the compiler by highlighting other parts of the code. These anchors might be put in places where you would expect the code to be changed but for some reason isn't. The user is able to see not only what the compiler does, but also what it doesn't do.

The mechanism for interpreting the anchors in the KMP scheme was to use a specific-purpose http server written by Stephen Adams. The HTML documents linked in the code are not generated until requested.

Highlighted KMP Scheme outputted from the lambda lifter phase is available for a sample program. These documents have been converted into ordinary HTML documents.

View the sample program

View the highlighted KMP Scheme


astark@martigny.ai.mit.edu