O'Reilly logo

The Definitive ANTLR 4 Reference, 2nd Edition by Terence Parr

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required