[antlr-interest] Token Names

Guntis Ozols guntiso at latnet.lv
Thu Jan 10 22:02:43 PST 2008


> Can't you override the error reporting method(s)?
> Ter

Yes, but...

This has been discussed before, I'll try to explain.

- it is flexible
  allows to reuse the same parser in different environments
  by providing different error handlers

- it is simple
  one glance at API + some programming expierence
  is enough to understand it

- it is not complex
  does not require to dig wiki and/or code
  does not require to understand antlr internals
  does not require to hack 4 methods

- it is what people expect
  many projects use this approach

- it does not pollute grammar
  error handling has nothing to do with grammar

- System.err is not flexible and not usable in production, is it?
  So everybody has to override exception handling anyway.
  If so, why not have flexible API in the first place?

- it will make this project look a bit more mature

I think adding some 15 lines of code for this is well worth it

Guntis



More information about the antlr-interest mailing list