Compiling with Command Trees
Master Project of Bernard Bot


Compilers translate high-level source code into low-level machine code. To represent source code a compiler uses a language called the intermediate representation (IR). An IR for the compilation of functional languages is continuation-passing style (CPS). It provides convenient abstractions for both data flow and control flow. However, CPS conversion is hard to write and the transformations on CPS are untyped. In this thesis we develop an IR based on CPS using the command tree data structure. Command trees allow us to express compiler transformations typically, declaratively, and modularly. The monadic nature of command trees allows us to bind commands together in a succinct manner. We test the usefulness of the new IR by building two versions of the LamToWat compiler that translates the lamdba calculus into WebAssembly. The first version will use a CPS IR and the second version a command tree IR.


Compiling with Command Trees

Student: Bernard Bot
Supervisor(s): Casper Bach Poulsen, Eelco Visser
Defended: May 19, 2021