[antlr-interest] Parser error management

Bryan Ewbank ewbank at synopsys.com
Tue Oct 12 13:12:29 PDT 2004


I can't do much more than echo your question; I'm leaning towards disabling
all ANTLR-generated messages and then coding exceptions where they are
needed - and code the necessary recovery action.

For example, if you're in an expression and it's scrambled, print an error
message and then scan for the next semicolon (i.e., expression terminator).

A few of us talked at ANTRL2004 about better error recovery, and one of the
suggestions (from Paul Lucas, I think) was to disable the default
processing, then add a (very) generous alternative where you need it:

	stmt
		: ( expr )? ';'
		| ( . { /* error message here */ } ( . )* )? ';'

This, of course, causes ambiguity errors when processing <stmt>, but that
can't be helped with the current model.

What I'd really like, and am looking at adding to ANTLR, is a new wildcard,
similar to ".", but not used in lookahead calculation.  This would enable
better error capturing, somewhat like the "error" pseudo-terminal in
yacc/bison...

Hope this helps, a bit...

> -----Original Message-----
> From: Joan Pujol [mailto:joanpujol at gmail.com]
> Sent: Sunday, October 10, 2004 12:37
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] Parser error management
>
>
>
> Hi,
>
> I'm doing a pseudocode language that's similiar to Java. It has to be
> used for didactic purpouses. Thus one of the more imortants things is
> a good error detection and recovery strategy. At the moment I haven't
> implemented anything yet (I used the default antlr code).
>
> My question is if someone can points me to good resources for doing a
> good error management in ANTLR. Or  good error recovery in general
> (that will be aplicable to ANTLR of course).
>
> A lot of thanks in advance,
>
> --
> Joan Jesús Pujol Espinar
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list