[antlr-interest] Removing global backtracking

Johannes Luber jaluber at gmx.de
Sun Feb 10 05:39:13 PST 2008


Andreas Bartho schrieb:
> Hello,
> 
> inspired by the recent discussion about global backtracking I tried to 
> remove global backtracking from my grammar. My plan was to enable 
> backtracking for each rule individually, then turn global backtracking 
> off and try to disable individual backtracking for one rule at a time to 
> identify the rules that cause problems.
> However, this does not work. ANTLR reports for a number of rules that 
> multiple alternatives can match a given input (even for rules that have 
> only one alternative).
> Isn't global backtracking and local backtracking for each rule supposed 
> to be equivalent? If not, how do they differ?
> I tried version 3.01 and the latest intermediate built.
> 
> Andreas
> 
I believe that this behavior means that you have an 
if-then-else-ambiguity in your grammar. Usually their default behaviour 
is the required one.

Johannes


More information about the antlr-interest mailing list