Surprised to see none of the expected flood of appreciation for this development, I conclude that I'm not the only one who wasn't watching the wire today. This is a *very* welcome development! Though all my struggles with ANTLR ultimately point to my own limitations, this kind of error-reporting will help me find and understand my failures much faster.
Cheers! Kyle ------Original Message------ From: Terence Parr Sender: [email protected] To: ANTLR Subject: [antlr-interest] good error handling Sent: Feb 20, 2010 4:22 PM Hi, As I rebuild ANTLR (v4) using v3, I'm trying to do a good job of their recovery. adding my notes here: http://www.antlr.org/wiki/display/~admin/Gracefully+handling+syntax+errors Just added to that page some nice sample code that I'm using. For input: grammar A; a : b catch [Exception e] {...} b : B ; ANTLR v4 gives the tasty error message: {code} error(17): A.g:2:4: unterminated rule (missing ';') detected at 'b catch' while looking for rule element {code} Oh, and it correctly recovers from the disastrous rule 'a' to create the AST for rule 'b'. (COMBINED_GRAMMAR A (RULES <mismatched token: [...@17,46:46='b',<63>,4:0], resync=a : b catch Exception e {...}> (RULE b (BLOCK (ALT B))) ) ) Ter List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address Sent from my Verizon Wireless BlackBerry List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
