The Effekt Compiler
The compiler pipeline for Effekt can be illustrated as follows:
The compilation is divided into the following large phases: parsing, frontend, middleend and backend. As can be seen, there are multiple backends. While the steps in the frontend phase are shared for all backends, some of the steps in the middleend are specific to some backends. Not all steps are fully implemented yet, some of them are still work in progress.
The source code modeling the pipeline can be found in Compiler.scala.
In the following we briefly describe the different phases.
The first step is to parse the given Effekt program into an AST in the IR called Source.
On Source there are several steps carried out, mainly
Subsequently the Source IR is translated step-by-step to different IRs.
- The first translation is to an IR in fine-grain call-by-value, called Core, which corresponds
System Xiin this paper and
System Cin this paper.
- On Core there is an optimization pass carried out.
- Afterwards Core is translated to an IR called Lifted by inferring lifting information as described here. This is finished for a large subset of Core, but still work in progress for first-class functions.
- From Lifted there is a translation to a more lowlevel IR called Machine, which is still work in progress.
The final step is the translation to the corresponding backend language. The different backends are targeted from different IRs.
- From Lifted there is a translation to Chez Scheme, too.
- From Machine there are two translations, one targets LLVM, the other one will enable a JIT-compiler. Both of these are still work in progress.