[antlr-interest] Check out TreeWizard

Terence Parr parrt at cs.usfca.edu
Mon Jul 2 19:36:12 PDT 2007


howdy,

Added an entry to my "blog" (which has moved to the wiki):

http://www.antlr.org/wiki/display/~admin/2007/07/02/Exploring+Concept 
+of+TreeWizard
After talking with Don Bradshaw at http://www.quipoz.com in Sydney  
and after trying to convert ANTLR v3's grammar (written in v2) into  
v3, I decided to build TreeWizard. You can create, navigate, and  
match trees very easily using tree patterns that are like interpreted  
ANTLR patterns (er...well, they pretty much are).  If people find it  
useful etc..., it will make it's way into ANTLR after we've groomed  
it etc...  Please try it out and let me know if it's useful for ya...  
It's pretty damn cool.  The following executes a method in action  
object for every subtree that matches the indicated pattern.

atreewizard.visit(t, "(VARDECL %type:. %id:ID)", mylistener);

'.' (dot) is the wildcard; type and id are labels that appear in a  
hashtable for the mylistener's visit() method to chew on.

All the code is attached to the wiki page.

Ter


More information about the antlr-interest mailing list