[antlr-interest] more on faster expression parsing

Terence Parr parrt at cs.usfca.edu
Thu Apr 10 18:10:26 PDT 2008


On Apr 10, 2008, at 2:52 PM, Gavin Lambert wrote:

> At 09:29 11/04/2008, Terence Parr wrote:
> ><http://www.antlr.org/wiki/display/~admin/2008/04/10/Still+more+about+expression+parsing 
> >
> >
> >I think that covers it.
> [...]
> >It also looks one level deep into rules referenced from the special  
> rule.
>
> Is it feasible to look further than one level?  (Ideally, to any  
> number of levels.)  Just in case someone wants to factor the grammar  
> a bit more.  Probably not a biggie, but if it's not hard to look  
> further then it might be a good idea.

We can start with one level :)  It's a pattern i'm looking for.

> >Rule suffix is left alone except for the removal of the left
> >recursion so you can add whatever tree construction you want
> >but you must allow a $lhs parameter to come in.
>
> This is a little unclear, since presumably in the source grammar  
> there will still be an 'e' in the lhs position, so surely they will  
> refer to that in the tree rewrite, not $lhs?  Perhaps it will get  
> internally converted into using $lhs, but I don't think it'd be like  
> that in the source rule, surely?

Yeah, it's a special rule invoked from a special rule; I could change  
all $e to $lhs in actions / trees I guess.
Ter



More information about the antlr-interest mailing list