Does ANTLR always backtrack if I use a syntactic predicates?
Created May 4, 2012
Terence Parr No. ANTLR only backtracks if it cannot decide between the predicated alternative and the others in that alternative block. So if you have:
stat : (decl)=>decl | expr | ifstat ;
then upon input "9", ANTLR will not backtrack as "9" cannot possibly start a decl--parsing will immediately proceed to the "expr" alternative without backtracking.