Re: [Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree

2010-07-25 Thread John Meacham
On Mon, Jul 19, 2010 at 01:51:52PM -0300, José Romildo Malaquias wrote: > data Exp > = IntExp Integer > | VarExp Symbol > | AssignExp Symbol Exp > | IfExp Exp Exp (Maybe Exp) > | CallExp Symbol [Exp] > | LetExp [Dec] Exp > > data Dec > = TypeDec Symbol Ty > | F

Re: [Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree

2010-07-23 Thread José Pedro Magalhães
Hi Romildo, 2010/7/23 José Romildo Malaquias > On Tue, Jul 20, 2010 at 09:17:15AM +0200, José Pedro Magalhães wrote: > > > > 2010/7/19 José Romildo Malaquias > > > > > > > > I am writing here to ask suggestions on how to annotate an ast with > > > types (or any other information that would be r

Re: [Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree

2010-07-23 Thread José Romildo Malaquias
On Tue, Jul 20, 2010 at 09:17:15AM +0200, José Pedro Magalhães wrote: > > 2010/7/19 José Romildo Malaquias > > > > > I am writing here to ask suggestions on how to annotate an ast with > > types (or any other information that would be relevant in a compiler > > phase) in Haskell. > > Indeed I w

Re: [Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree

2010-07-21 Thread S. Doaitse Swierstra
Despite the interesting discussing which has followed this question I think that in orde to approach this specific problem the use of a specific compiler-writers toolset such as the uuagc (http://hackage.haskell.org/package/uuagc-0.9.29)) system is to be preferred; it provides aneffiicent and m

Re: [Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree

2010-07-20 Thread José Pedro Magalhães
Hi José, 2010/7/19 José Romildo Malaquias > > I am writing here to ask suggestions on how to annotate an ast with > types (or any other information that would be relevant in a compiler > phase) in Haskell. > > As an example, consider the simplified ast types: > > data Exp >= IntExp Integer

Re: [Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree

2010-07-19 Thread ajb
G'day all. Quoting José Romildo Malaquias : I am writing here to ask suggestions on how to annotate an ast with types (or any other information that would be relevant in a compiler phase) in Haskell. This might help: http://www.haskell.org/haskellwiki/Indirect_composite Andrew Bromage _

Re: [Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree

2010-07-19 Thread Job Vranish
Ah, I found the attachment on your other email. I would recommend using the Fix and Ann types, instead of the AnnFix type. I modified your code a bit (and fixed the Show instances etc...) and put it here: http://hpaste.org/fastcgi/hpaste.fcgi/view?id=27823#a27823 Let me know if you have question

[romi...@malaquias.dhcp-geral: Re: [Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree]

2010-07-19 Thread José Romildo Malaquias
Forgot the attachment. Romildo --- Begin Message --- On Mon, Jul 19, 2010 at 01:51:57PM -0400, Job Vranish wrote: > Martijn van Steenbergen has a good blog post that describes the method I > generally use: > http://martijn.van.steenbergen.nl/journal/2010/06/24/generically-adding-position-informati

Re: [Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree

2010-07-19 Thread Malcolm Wallace
I would be inclined to add type annotations as an extra constructor of the expression representation type. data Exp = IntExp Integer | VarExp Symbol | AssignExp Symbol Exp | IfExp Exp Exp (Maybe Exp) | CallExp Symbol [Exp] | LetExp [Dec] Exp | Exp `HasType` Ty This i

Re: [Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree

2010-07-19 Thread Job Vranish
Martijn van Steenbergen has a good blog post that describes the method I generally use: http://martijn.van.steenbergen.nl/journal/2010/06/24/generically-adding-position-information-to-a-datatype/ In his example he annotates the expression tree with position information, but you can use the same me

[Haskell-cafe] Tiger compiler in Haskell: annotating abstract syntax tree

2010-07-19 Thread José Romildo Malaquias
Hello. In his book "Modern Compilder Implementation in ML", Appel presents a compiler project for the Tiger programming language where type checking and intermediate code generation are intrinsically coupled. There is a function transExp :: Absyn.Exp -> (Tree.Exp,Types.Type) that do semantic