[antlr-interest] Parser error management

Bryan Ewbank ewbank at synopsys.com
Wed Oct 13 10:14:39 PDT 2004


The key difference is that ANTLR is all-or-nothing (except for the
"defaultErrorHandler=true/false" option), but if you specify the exceptions
explicitly you only do in on the rules where it makes some sense from your
point of view.  For example, I have a C-like language.  If I'm in the middle
of processing an expression and see an illegal token, I would walk to leap
all the way out to <statement> and scan for the trailing semicolon, rather
than attempting to catch it somewhere in <expression_plus>,
<expression_shift>, and so on.

Perhaps the default messages are good enough for your application, perhaps
not.  For my application, I need to provide a standard
"filename:lineno:text" style message if there is a syntax/semantic error -
something that is not provided in the default messages.  I'd also like to
have "expected ..." as part of the message, which means that the default is
not good enough for me.

Of course, there may be some way to tweak the defaults that I have not
stumbled across.  I'm generating C++, which places me (I think) in the
minority here.

> -----Original Message-----
> From: Joan Pujol [mailto:joanpujol at gmail.com]
> Yes, but when I have disabled the exceptions what strategy can I use
> to gain some advantage versus the ANTLR default error handling?
>
> But it's not the same that do ANTLR? Or the same that I can get doing
> some exception catching?



 
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