[antlr-interest] Problem with ANTLR

Terence Parr parrt at cs.usfca.edu
Sat Jan 5 10:47:13 PST 2008


Hmm...should work.  What does the generated code for expression look  
like?
Ter
On Jan 5, 2008, at 8:27 AM, John Ridgway wrote:

> 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