[antlr-interest] Attribute Access in Tree Grammar Actions

Randall R Schulz rschulz at sonic.net
Sat Jun 30 06:54:50 PDT 2007


On Saturday 30 June 2007 04:42, Benjamin Niemann wrote:
> Randall R Schulz wrote:
> > ...
> >
> > How to I get at the return values of rules when those rules appear
> > on the right-hand-side of another rule?
>
> If equation looks like
>
> equation returns [ Formula f ]
> ...
>
> you'll have to use "$equation.f" to get at the return value.

Thanks. I finally figured that out.


> >> And I think you're also supposed to say $f rather than just
> >> f.  Gives the code generator the opportunity to move things
> >> around.
> >
> > ...


Randall Schulz


More information about the antlr-interest mailing list