[antlr-interest] PEG-style "and" predicates

Richard Clark rdclark at gmail.com
Mon Jul 2 17:55:05 PDT 2007


BTW. the fate of predicates is a little ambiguous (so to speak). Page
318 of the ANTLR hymnal says this about semantic predicates:

> For efficiency reasons, ANTLR hoists predicates
> into DFAs only when LL(*) lookahead alone is
> insufficient to distinguish alternatives.

Yet on page 333:

> To be precise, manually specified syntactic
> predicates become gated semantic predicates.
> These syntactic predicates are always evaluated
> just like gated semantic predicates.
>
> On the other hand, syntactic predicates implicitly
> added by auto-back-tracking mode become regular
> semantic predicates. Such predicates are evaluated
> only when LL(*) fails to predict an alternative.

So, I believe my point #2 was wrong -- if you add it by hand (as you
did), it should always be evaluated.

Thus we have a mystery.

 ...Richard

P.S. to Ter -- my favorite MPW error message is "Too many errors on
one line (make fewer)" See
http://www.ralentz.com/old/mac/humor/mpw-c-errors.html


More information about the antlr-interest mailing list