[antlr-interest] transforming AST's in place when generated

Carter Cheng carter_cheng at yahoo.com
Fri Feb 22 13:16:45 PST 2008


Hi everyone,

Thanks for the responses so far from everyone on the
group. It turns out that my last problem was an error
in my AST generation and the code compiles fine now
without messing with the UP constant.

I have a further question about AST's. I have some
rather standard looking variable declarations in my
language which just like C look like this: 

int a,b,*c,*d; 

I am curious from an AST perspective how to generate
an AST for this which would have the equivalent of
each declaration on a separate line since this is
semantically equivalent i.e.

(DECL
(VAR_DECL int a)
(VAR_DECL int b)
(VAR_DECL int * c)
(VAR_DECL int * d)
(FUN_DEF .... )
)

Is this sort of thing possible without typing up code
in the host language?

Thanks in advance,

Carter.


      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs


More information about the antlr-interest mailing list