None of those suggestion will help with the actual grammar unfortunately. It
is indeed ambiguous, that is the warning I get if I turn backtracking off,
but I can't refactor the rules (or the actual, large grammar) w/o ending
with a completely meaningless AST.

I still don't understand why antlr won't backtrack there, I suspect this is
a limitation of the implementation strategy that uses predicates; or maybe I
am expecting too much and the kind of backtracking required here would be
too hard or expensive to implement?
Basically I have an ambiguous but valid non left-recursive grammar, and I
don't see why antlr after failing on one branch doesn't backtrack to try the
other branch of the ambiguity.

I do use the debugger, and it shows that the (automatically generated)
syntactic predicate for expr passed ( DOT ^( EXPR "c" ) ) and that b.c was
accepted as an expr, and the next node in the parse tree is the
MissingTokenExpression at = (the parser expects a separator at that point).

Replacing the '.' literal by an explicit DOT token doesn't make any
difference.

--
View this message in context: 
http://antlr.1301665.n2.nabble.com/Confused-about-backtracking-tp7033712p7039721.html
Sent from the ANTLR mailing list archive at Nabble.com.

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to