[antlr-interest] Fwd: Fwd: Better Error Reporting in ANTLR

Adam Connelly adam.rpconnelly at googlemail.com
Thu Apr 17 14:48:47 PDT 2008


Bollocks, did it again.

---------- Forwarded message ----------
From: Adam Connelly <adam.rpconnelly at googlemail.com>
Date: 17 Apr 2008 22:48
Subject: Re: [antlr-interest] Fwd: Better Error Reporting in ANTLR
To: Terence Parr <parrt at cs.usfca.edu>

It could though, and I actually wrote it up and got it working by making a
subclass of the parser class that my grammars would extend from that just
delegated stuff to the handler.  I guess the idea I had was that you could
figure out all the different semantic errors that you could have, then write
an exception class for each of them.  That would form a sort of interface
for your language that any error handler written for it would have to be
able to cope with.  This would allow you to write different handlers for the
same language that would do different things.

The TokenInfo objects and TokenInfoSource that would allow handlers to
create more meaningful messages would be generated at the same time as the
grammar.

Or maybe I'm not understanding what you mean?

Cheers,
Adam

On 17/04/2008, Terence Parr <parrt at cs.usfca.edu> wrote:
>
>
> On Apr 17, 2008, at 12:14 PM, Adam Connelly wrote:
>
>  Cool, sounds good.  I think for me the most useful part of it is
> > distinguishing between the token name, a description of the token and the
> > text matched on the input so you can do stuff like "expected ';'" instead of
> > "expected SEMI" without having to override error reporting methods.
> >
>
> EManager thing  would only help antlr messages not generated parser msgs.
> Ter
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080417/4df9deca/attachment.html 


More information about the antlr-interest mailing list