Towards Modular Compilation Using Higher-Order Effects

Conference Paper (2023)
Author(s)

Jaro Reinders (TU Delft - Programming Languages)

Research Group
Programming Languages
Copyright
© 2023 J.S. Reinders
DOI related publication
https://doi.org/10.4230/OASIcs.EVCS.2023.22
More Info
expand_more
Publication Year
2023
Language
English
Copyright
© 2023 J.S. Reinders
Research Group
Programming Languages
ISBN (electronic)
9783959772679
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 transform a human readable source language into machine readable target language. Nanopass compilers simplify this approach by breaking up this transformation into small steps that are more understandable, maintainable, and extensible. We propose a semantics-driven variant of the nanopass compiler architecture exploring the use a effects and handlers to model the intermediate languages and the transformation passes, respectively. Our approach is fully typed and ensures that all cases in the compiler are covered. Additionally, by using an effect system we abstract over the control flow of the intermediate language making the compiler even more flexible. We apply this approach to a minimal compiler from a language with arithmetic and let-bound variables to a string of pretty printed X86 instructions. In the future, we hope to extend this work to compile a larger and more complicated language and we envision a formal verification framework from compilers written in this style.