[antlr-interest] Implicit Parser Rule Return Types

Randall R Schulz rschulz at sonic.net
Tue Nov 21 11:16:16 PST 2006


Terence,

On Tuesday 21 November 2006 11:04, Terence Parr wrote:
> On Nov 21, 2006, at 10:52 AM, Randall R Schulz wrote:
> > So my question is this: Why does one rule return something when the
> > other does not even though both of them have terminals as their
> > right-hand-side?
>
> if in an action you reference one of those rules' attributes, then it
> creates the return structure.  Because this is expensive, it tries to
> avoid at all costs.

OK, except that nothing I do triggers the generation of (non-void) 
return value from the binaryConnective rule in the manner that 
referencing the ".text" attribute of an instance of the "name" rule 
does.

What's the trick?


> Ter


Randall Schulz


More information about the antlr-interest mailing list