Syntax Macros For Free
Center
The following paper was submitted to the Haskell 2010.
Title : First Class Syntax, Semantics, and Their Composition
Subtitle: How to assemble a compiler on the fly
Authors : Marcos Viera, S. Doaitse Swierstra, Atze Dijkstra and Arthur Baars
Abstract : The idea of having an extendible language is appealing and raises the
question how to construct extensible
compilers. In recent years we have developed a collection of
techniques which together make
this possible in Haskell: transformation of typed abstract
syntax trees makes it possible to construct parsers on the fly in a
type-safe way, parser combinators make it possible to construct
parsers dynamically, and first-class attribute grammars make it possible to define semantics in a compositional way.
In this paper we show how, using a small example language and its extension, these
techniques come together in constructing compilers out of a collection of pre-compiled, statically type-checked, possibly mutually
dependent ``language-definition fragments''. This way of constructing a compiler brings syntax macros for free.
Paper:
pdf
Package:
SyntaxMacros