[antlr-interest] Attribute Access in Tree Grammar Actions
Randall R Schulz
rschulz at sonic.net
Fri Jun 29 16:20:22 PDT 2007
On Friday 29 June 2007 15:45, Randall R Schulz wrote:
> On Friday 29 June 2007 15:28, Gavin Lambert wrote:
> > ...
> >
> > I think you need to use $equation.value and $atom.value. Or
> > something like that :)
>
> Evidently it's "or something like that."
OK. I think I've sorted it out. Some other problems with my grammar must
have been cause the unadorned return types from rules. Now ANTLR is
generating the usual <<rulename>>_return types and then the rule return
attributes are referenced by their declared names.
> When I look at the generated source code, equation(), atom() and
> atomicSentence() all declare plain, unadorned Formulas, as their
> return types.
I don't know why that was happening, but it isn't any more. It probably
had to do with other problems in the rule's action (perhaps the missing
$ prefix on references to the return value name).
> ...
Randall Schulz
More information about the antlr-interest
mailing list