You need backtracking if you have an ambiguous grammar. This comes up in natural language parsing; I'd guess that it is avoided in programming languages.
Actually, many languages which started with hand written parsers do have ambiguous grammars, or have an unambiguous grammar so hideously unwieldy it is best ignored.
This sort of thing can be fixed up with predicates added to the grammar but it always feels like a bodge.
I totally agree with this. I was assuming the case of a default behavior like shift or reduce force fully for unambiguous grammars, which I should have mentioned. Thanks.
This sort of thing can be fixed up with predicates added to the grammar but it always feels like a bodge.