PhD Transfer Report: The Modular Compilation of Effects
Laurence E. Day · 2011
Compilers are traditionally factorised into smaller components, each dealing with an individual stage of the process, such as parsing, typechecking, code generation and optimisation. The advantage of such an approach is that each component can be designed, implemented, tested and (ideally) proved correct independent of other components. During the course of my first year, I have begun to investigate an alternative method of factorising a compiler, namely according to the effects supported by the source language. More importantly, I seek to develop a compiler in such a way that the addition of a new effect requires minimal extensions to existing code. In this report I present the preliminary results of my research into the code generation stage of the modular compilation of programming languages according to the effects which they support. To this end, I demonstrate an elegant combination of previously developed techniques from the literature to decouple the recursive and syntactic aspects of a source language, and develop a semantics, compiler and virtual machine for such a language which is parameterised over its syntax and the monads which support effectful operations. All prerequisite knowledge to engage with the research material is presented in a background section within the opening chapters of this report. In addition, I present a detailed review of the existing literature concerning compiler modularity and the characterisation of effects, and lay out a preliminary draft for the structure of the doctoral thesis which this research aims towards.