Automatic Error Recovery Strategy
Error recovery is what allows the parser to continue after finding a syntax error. In principle, the best error recovery would come from the human touch in a handwritten recursive-descent parser. In my experience, though, it’s really tough to get good error recovery by hand because it’s so tedious and easy to screw up. In this latest version of ANTLR, I’ve incorporated every bit of jujitsu I’ve learned and picked up over the years to provide good error recovery automatically for ANTLR grammars.
ANTLR’s error recovery mechanism is based upon Niklaus Wirth’s early ideas in Algorithms + Data Structures = Programs [Wir78] (as well as Rodney Topor’s A Note on Error Recovery in Recursive Descent Parsers [Top82] ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access