Functional pearl typed quote/antiquote or: Compile-time parsing

Haskell (Peyton Jones, 2003) is often used as a host language for embedding other languages. Typically, the abstract syntax of the guest language is defined by a collection of datatype declarations; parsers and pretty-printers convert between the concrete syntax and its abstract representation. A qu...

Celý popis

Podrobná bibliografie
Hlavní autor: Hinze, R
Médium: Journal article
Jazyk:English
Vydáno: 2011
Popis
Shrnutí:Haskell (Peyton Jones, 2003) is often used as a host language for embedding other languages. Typically, the abstract syntax of the guest language is defined by a collection of datatype declarations; parsers and pretty-printers convert between the concrete syntax and its abstract representation. A quote/antiquote mechanism permits a tighter integration of the guest language into the host language by allowing one to use phrases in the guest language's concrete syntax. For a simple example, assume that the abstract syntax of the guest language is given by the following datatype of binary trees. © 2011 Cambridge University Press.