[antlr-interest] AST generation: EXPRESSION TREE example.

Bharath Sundararaman bharath at starthis.com
Wed Jun 2 14:58:24 PDT 2004


Hi Monty,

I fully qualified PLUSNode, INTNode and MULTNode and it works :-). I have a
language similar to PASCAL and the syntax analysis is complete. To generate
an AST with a decent structure (based on my needs), my understanding is that
I have to add qualifiers (^, !) to each rule and modify existing rules to
make them AST friendly. Is this a cumbersome process? 

Thanks again. 

Bharath.

-----Original Message-----
From: Monty Zukowski [mailto:monty at codetransform.com] 
Sent: Wednesday, June 02, 2004 4:36 PM
To: antlr-interest at yahoogroups.com
Cc: Monty Zukowski
Subject: Re: [antlr-interest] AST generation: EXPRESSION TREE example.


On Jun 2, 2004, at 2:35 PM, Bharath Sundararaman wrote:

> Yes, they do. In fact, if I don't use INTNode, PLUSNode and MULTNode
> in my
> grammar and just use CalcAST in my "main" class which runs the parser 
> and
> the lex, it works fine. I can correctly resolve CalcAST and use it. 
> Should I
> qualify my usage of INTNode, PLUSNode and MULTNode? In my tokens 
> section, I
> have the line "PLUS<AST = PLUSNode>;". Also, all my class files exist 
> under
> one same package.

You probably have to qualify the node name.  Try PLUS<AST = 
mypkg.PLUSNode>

Monty Zukowski

ANTLR & Java Consultant -- http://www.codetransform.com
ANSI C/GCC transformation toolkit -- 
http://www.codetransform.com/gcc.html
Embrace the Decay -- http://www.codetransform.com/EmbraceDecay.html



 
Yahoo! Groups Links



 




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list