Compiling embedded languages
Conal M. Elliott, Sigbjørn Finne, Oege de Moor · Journal of Functional Programming · 2003
Functional languages are particularly well-suited to the interpretive implementations of Domain-Specific Embedded Languages (DSELs). We describe an implemented technique for producing optimizing compilers for DSELs, based on Kamin's idea of DSELs for program generation. The technique uses a data type of syntax for basic types, a set of smart constructors that perform rewriting over those types, some code motion transformations, and a back-end code generator. Domain-specific optimization results from chains of domain-independent rewrites on basic types. New DSELs are defined directly in terms of the basic syntactic types, plus host language functions and tuples. This definition style makes compilers easy to write and, in fact, almost identical to the simplest embedded interpreters. We illustrate this technique with a language Pan for the computationally intensive domain of image synthesis and manipulation.
Cited by 146 works. doi:10.1017/s0956796802004574 Open-access PDF
Authors
References
- The next 700 programming languages
- Fast Algorithms for Finding Nearest Common Ancestors
- Partial evaluation and automatic program generation
- Expression templates
- A fast Fourier transform compiler
- Modern Compiler Implementation in C
- A linear algorithm for finding dominators in flow graphs and related problems
- Modular domain specific languages and tools
- Domain specific embedded compilers
- The Haskell School of Expression