[antlr-interest] uh oh...trouble in meaning of (..)=> pred!!!

Gavin Lambert antlr at mirality.co.nz
Thu Mar 15 12:18:04 PDT 2007

At 07:16 16/03/2007, Terence Parr wrote:
 >Hi. I believe a PEG would do
 >a b &c &d
 >using & predicates that match but don't consume.

Actually thinking on it a bit more, I wonder if using a "!!" 
suffix might be more appropriate (as in "a b c!! d!!").  That way, 
one ! means "match, consume, but don't output", and two !s means 
"match, don't consume, and don't output".

(I still think ! should work in the lexer, though, even if only as 
a prefix/suffix for performance reasons.  That's the most common 
case anyway.)

 >Auto backtracking will do the optimal "use synpred only if 
 >fails", but (...)=> manual predicates will force backtracking to 

 >eval the pred.  I can't know what's inside compared to alt
 >whereas with auto backtracking pred is copy of alt.

Oh, right, you have to avoid executing actions while in a path 
that can potentially backtrack, so they need to be gone through 
twice.  Forgot about that.

More information about the antlr-interest mailing list