[antlr-interest] sneak preview of ANTLR v3.2 (book release version)

Terence Parr parrt at cs.usfca.edu
Sun Nov 30 12:33:54 PST 2008


On Nov 30, 2008, at 9:35 AM, Oliver Zeigermann wrote:

> I tried this out and it actually works great :)

Hooray!  Should I add some rewrite examples?

> I am wondering if "bottomup" is really needed, though. I only need
> "topdown" as the whole structure already is encoded in the tree. So
> there is no need to track context for me in that way.
>
> Do you have any use case for that?

Yep, you want to pop scope as you go back up the tree.  Push scope on  
way down.  Remember that matching a method or block pattern is just  
that; don't tell it how to walk the body or whatever.

m : ^(METHOD type=. ID body=.) {push scope} ;

remember we are now just telling it what to match, no how to walk the  
tree. it will walk the type and body for us.  You can't put the "pop  
scope" action in the same rule.

> Cheers and thanks for that cool feature :)

My pleasure.
Ter


More information about the antlr-interest mailing list