[antlr-interest] Problem with ANTLR

John Ridgway john at jacelridge.com
Sat Jan 5 08:27:11 PST 2008


Friends -
I have the following issue with ANTLR (3.1beta):

I know that you can use the goal of a rule inside a rule when building  
an AST; for instance:

expression
     :   ( primary -> primary )
         ( arguments -> ^(CALL $expression arguments) ) *
     ;

but I want to pass the goal to the subsidiary thing, thusly:

expression
     :   (primary -> primary )
         ( selector[$expression.tree] -> selector )*
     ;

selector[Tree expr]
     : ...
     ;

This doesn't work, (the passed value is always null).  Is that a  
fundamental restriction or a bug?  (Or a feature?) :-)

Peace
- John



More information about the antlr-interest mailing list