[antlr-interest] syntactic predicates and exceptions

Terence Parr parrt at cs.usfca.edu
Thu Nov 17 10:04:14 PST 2005


On Nov 16, 2005, at 7:37 PM, Pete Gonzalez wrote:
> Terence Parr wrote:
>> The *LEXER* is backtracking?  Oh gawd, it will kill you.  See  
>> what  the java grammar does for matching numbers...I think it  
>> avoids them.   An exception per char is deadly.
>
> Thanks!  I tried the lexer from your Java grammar and this  
> eliminated the exceptions.  The improvement is significant:  0.406  
> secs outside of debugger (i.e. 48% of original), 0.456 secs in the  
> debugger (i.e. 0.8%!).  :-)

Hooray!

> FYI I noticed that Todd King recently posted an updated C# grammar  
> on the Antlr web site saying:
>
> "I designed this grammar for speed so I avoided using arbitrary  
> lookaheads where I could. I got it down to just 7 lookaheads."
>
> However, he is using the exact same lexer (from Robin Debreuil)  
> with backtracking.  I didn't see an e-mail address, but someone  
> should notify him about the technique used in your Java lexer.

I don't see his email anywhere so might be hard to contact him.

>> I'll be doing an auto-converter to 3.0.  Current version I just   
>> released is pretty usable if you ask me, but I'm going to try it  
>> out  on a real app soon to see if it does anything useful.  It  
>> crashes on  bad input at the moment etc...  I wouldn't bet my job  
>> on it yet ;)   3.0 eta will be next summer probably.
>
> I took a look at the 3.0 examples and this new design really does  
> "kick ass" to quote a PowerPoint slide.  I think you are doing some  
> genuinely innovative work, and I think your approach to the problem  
> is right on.  I'm really looking forward to this release, and will  
> give the "early access" build a try as soon as the C# codegen is in  
> place.  Anyway, thanks for your help!

My pleasure.  Thanks for the nice words.  I've been collecting ideas  
from people for years and forging them into a single coherent theme  
for v3.  Some of the stuff is really crazy cool like the rewrite from  
grammar to tree grammar for tree construction.  It's been a mad rush  
for 2.5 years, 3 by the time I finish.  With the addition of tools  
like ANTLRWorks and ANTLRStudio, I think making languages/data  
translators etc... will be much easier. :)

Ter


More information about the antlr-interest mailing list