[antlr-interest] Re: syntactic predicates and semantic predicates

Bill Canfield canfield at computer.org
Wed Aug 24 10:19:24 PDT 2005


> From: Bryan Ewbank <ewbank at gmail.com>
> 
> I've been doing some profiling (generating C++ code), and come to the
> conclusion - no real surprise - that throwing exceptions are very
> expensive.
> 
> How this works out in ANTLR is that I'm replacing syntactic predicates
> with semantic predicates whereever possible:

That's a good observation.  I had a similar epiphany a few weeks ago, 
due to TokenStreamSelector::retry().  retry() is just a wrapper around a 
throw(), so if you switch streams a lot, you'll want to have something 
besides retry() to stitch them all together.

Bill


More information about the antlr-interest mailing list