Compiling with Command Trees

Master Thesis (2021)
Author(s)

B.R.A. Bot (TU Delft - Electrical Engineering, Mathematics and Computer Science)

Contributor(s)

C.B. Poulsen – Mentor (TU Delft - Programming Languages)

Eelco Visser – Coach (TU Delft - Programming Languages)

B. Ozkan – Coach

Faculty
Electrical Engineering, Mathematics and Computer Science
Copyright
© 2021 Bernard Bot
More Info
expand_more
Publication Year
2021
Language
English
Copyright
© 2021 Bernard Bot
Graduation Date
19-05-2021
Awarding Institution
Delft University of Technology
Programme
['Computer Science']
Related content

Source code repository

https://github.com/BernardBot/LamToWat
Faculty
Electrical Engineering, Mathematics and Computer Science
Reuse Rights

Other than for strictly personal use, it is not permitted to download, forward or distribute the text or part of it, without the consent of the author(s) and/or copyright holder(s), unless the work is under an open content license such as Creative Commons.

Abstract

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.

Files

License info not available