[antlr-interest] internal error

Steve Bennett stevagewp at gmail.com
Sat Feb 2 01:05:14 PST 2008


On 2/2/08, Gavin Lambert <antlr at mirality.co.nz> wrote:
> source.)  Where the defensive line should be drawn is at the
> compiler generating that code, which should detect that incorrect
> generated code will result and report it as an error to the
> grammar author.  However this is not yet possible due to the
> structure of ANTLR (since it's still using an old version
> internally), so fixing it will have to wait until the structure is
> updated."

It would certainly be useful to people like me who aren't very
familiar with the structure of ANTLR if the following types of errors
could be distinguished:

1) User error in ANTLR grammar (eg, missing semicolon)
2) Error in generated code (that is, Java couldn't compile it)
3) Other inability to generate code (eg, lack of heap space, couldn't
find tokens file...)
4) User error in input (that is, the input doesn't match the grammar)

 and possibly:

5) User error in embedded, compiled code (eg, the target code you
write into a rule is itself faulty)
6) Other runtime error in generated code (whether caused by a faulty
grammar or a problem in the generator)

I notice that sometimes errors in category 2 and 3 give spurious
errors like "nullpointerexception" and it can be confusing for novices
like me to understand what the error is and where it's coming from. So
it's very pleasing to know that this will all be magically fixed in
the next five minutes :)

Steve


More information about the antlr-interest mailing list