Typed Quote/Antiquote—Or: Compile−time Parsing

Haskell 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 data type declarations; parsers and pretty-printers convert between the concrete syntax and its abstract representation. A quote/antiquote mechan...

全面介绍

书目详细资料
主要作者: Hinze, R
格式: Journal article
出版: 2011
实物特征
总结:Haskell 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 data type 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. A quote/antiquote mechanism usually requires an extension of the host language. The purpose of this pearl is to show that one can program such a mechanism within Haskell itself. The technique is based on Okasaki's flattening combinators.