[Haskell-cafe] Generating AST using Parsec

Stephen Tetley stephen.tetley at gmail.com
Sun Dec 27 05:42:30 EST 2009

Hi Kashyap

Algebraic data types in Haskell and other modern functional languages
are so convenient for describing syntax trees that you don't have need
for a 'tree builder' vis-a-vis Java Tree Builder or JJTree that you
might use in Java.

The original Parsec distribution has parsers and ASTs for Henk and
Andrew Appel's Tiger language and is available here:


Unfortunately the package on Hackage has removed the examples. Parsec
can be considered a progression of the ideas detailed in Hutton and
Meijer's "Monadic Parser Combinators".

Best wishes


2009/12/27 CK Kashyap <ck_kashyap at yahoo.com>:

> However, the parser developed in the paper does not generate an AST - I feel, I'd grasp the whole thing a lot better if I could go over a sample that generates an AST from a simple expression (or even a standard language such as C or Java) ... Can someone please point me to a sample that generates AST - preferably with the simple parser combinator given in the paper.

More information about the Haskell-Cafe mailing list