[antlr-interest] making AST from subrule as root AST in automatic AST generation

prashanth501 prashanth501 at yahoo.com
Tue Jul 29 12:02:49 PDT 2003


Hello,

 I've been having dome problems with automatic AST generation.
For example if I have a rule

op:
  PLUS
| MINUS
| AND
| OR

and then when i use this rule in the def of

expr: term (op^ term)*

but, expr: term ((PLUS^ | MINUS^ | AND^ | OR^) term)* 
works.

ANTLR doesnt allow me to use the '^' sign next to 'op' because op is 
a rule. Well, there are workarounds, by constructing the tree myself, 
but i would prefer if there was a mechanism to use '^' sign next to a 
rule in the automatic AST construction because, there are other 
places in my parser where it is not nice to use a fix similar to the 
one above.
 
If anybody knows how to do that, please let me know.

Thank You.
Prashanth...



 

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




More information about the antlr-interest mailing list