[Haskell-cafe] Annotaing abstract syntax trees

José Pedro Magalhães jpm at cs.uu.nl
Wed May 9 10:28:34 CEST 2012


Hi Romildo,

I had a quick look at your code. In general it seems fine, although I
haven't tested it. You might want to use HLint to give you coding tips.

I don't understand your remark about wanting the "type checker to produce
an expression annotated with both positions and calculated types". Can't
you make `exprTypeCheck` operate on `Ann (Range, ExprType) ExprF` instead
of just `Ann ExprType ExprF`?


Cheers,
Pedro

[1] http://community.haskell.org/~ndm/hlint/

On Tue, May 8, 2012 at 3:05 PM, José Romildo Malaquias
<j.romildo at gmail.com>wrote:

> 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 --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120509/49eb8236/attachment.htm>


More information about the Haskell-Cafe mailing list