[antlr-interest] syntactic predicates and exceptions
Pete Gonzalez
pgonzalez at bluel.com
Wed Nov 16 19:37:47 PST 2005
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%!). :-)
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'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!
Cheers,
-Pete
More information about the antlr-interest
mailing list