[antlr-interest] How is backtracking implemented?

Terence Parr parrt at cs.usfca.edu
Sun Feb 24 17:39:39 PST 2008


On Feb 24, 2008, at 5:25 PM, Olivier Lefevre wrote:

> 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?

typo. sorry. backtrack=true is correct.

Ter


More information about the antlr-interest mailing list