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

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

Reply via email to