[antlr-interest] Article against TreeWalkers

Jeff Barnes Jeff.Barnes at codesic.com
Fri Mar 10 12:50:32 PST 2006


Terence said:

hi, everybody!  Actually, I don't do that.  I create methods, one for 
each rule and switch on the lookahead to jump to the rule...not a big 
fan of lots of classes to do this for me--this is why I build tree 
recognizers not hand-built heterogeneous classes just to switch on 
token type.  
 
I say:
You don't need lots of classes. You don't need a switch statement either. And frankly it's just not expensive to make first class objects out of TokenTypes. Instead of trying to describe the grammar using 3 levels of metadata, it can be described in relationships. Much prettier model. 
 
Regards,
Jeff


More information about the antlr-interest mailing list