[antlr-interest] syntactic predicates and exceptions

Micheal J open.zone at virgin.net
Thu Oct 20 08:32:50 PDT 2005


> Nigel Sheridan-Smith wrote:
> > I don't want to weigh in to this argument too much, but I 
> do want to 
> > mention one point.
> > 
> > If you remove exception handling for back-tracking, there 
> is one risk: 
> > the readability of the code (and hence the ease of debugging and 
> > tracing) will be reduced.
> > 
> Don't underestimate this point. The readability is one of the main 
> selling points of antlr. At least that is how I get away with 
> using it 
> in a yacc shop.

Actually, the selling point is that it generates code that resembles what a
person might write while developing a hand-crafted parser. Getting rid of
exceptions for backtracking takes ANTLR closer to that ideal.  ;-)

Seriously, I have hand-crafted and also generated code that eschew the use
of exceptions for all but *truly* exceptional events and yes, the speed
boost is substantial and, I've had no problems come debug time. I don't
remember ever wishing it was more like ANTLR's default code output. I do
remember the satisfaction of seeing my language processors execute more
quickly than they would have otherwise ;-)

Cheers,

Micheal



More information about the antlr-interest mailing list