[Haskell-cafe] Annotaing abstract syntax trees

José Romildo Malaquias j.romildo at gmail.com
Tue May 8 16:05:30 CEST 2012


Hello.

I am reading Martijn's MSc Thesis "Generic Selections of
Subexpressions", where one can found some discussions about annotating
abstract syntax trees (AST).

In order to follow the discussion I wrote the attached Haskell program,
which is an interpreter for an simple typed expression language. The
Annotations package is used.

The expression pattern is represented by a single recursive data
type. Annotations are used for positions in the input source, and also
for the type of expressions and subexpressions.

I would like somebody to review the code and comment on it, as I am not
sure I am using the concepts right.

Also I would like the type checker to produce an expression annotated
with both positions and calculated types. Currently it discards the
position annotations. Any sugestions on how to modify it is welcome.

Next step is adding a new form of expression to introduce local variable
bindings.

After that I want to start working with ASTs represented by mutually
recursive data types. Then I will need multirec...

Romildo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Expr.hs
Type: text/x-haskell
Size: 9410 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120508/262afb78/attachment.hs>


More information about the Haskell-Cafe mailing list