[antlr-interest] ast rewrites in left-recursive rules

Terence Parr parrt at cs.usfca.edu
Wed Feb 23 17:16:51 PST 2011


On Feb 23, 2011, at 5:07 PM, Sam Harwell wrote:

> Inside the following rewrite:
> 
> e : e '*' b=e -> ^(...);
> 
> e refers to the first e (the one right after the ':' in the rule)
> $e refers to the enclosing rule (the tree created so far)
> $b refers to the second e (the one labeled 'b=')

Yep, I think that this is the way I got it working now.

> I'm sure you've noticed I've been pushing AST operators recently. :) With

They are very nice for expressions, which was the major motivation for their creation back in '92.

> the extended syntax,

[I've got to go look at your extended syntax now; ok, i'll think about that one]

Ter


More information about the antlr-interest mailing list