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

Get The Definitive ANTLR 4 Reference, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.