[antlr-interest] How is backtracking implemented?

Olivier Lefevre lefevrol at yahoo.com
Sun Feb 24 17:25:06 PST 2008


If you add "options {backtrack=true;}" to your grammar the generated code 
will include conditionals like "if (backtracking>0)" (or "=0") but nowhere 
is backtracking set: it still has the value of 0 to which it was 
initialized in BaseRecognizer, so I don't understand how that can work...

Also, in Chapter 5 the backtracking option is spelled "backtrack" but 
elsewhere in the book one also encounters "options {backtracking=true;}", 
so this is confusing: what is the difference?

Thanks,

-- O.L.



More information about the antlr-interest mailing list