[antlr-interest] syntactic predicates and exceptions

Martin Probst mail at martin-probst.com
Wed Oct 19 15:09:06 PDT 2005


Hi,

> But when it comes to parsers, it's almost a sure thing that input is going
> to fail more often than it doesn't.  At least with human-generated input.

Ehm, at this place I got to raise a voice. We - and many others
apparently - are using ANTLR in a server setup. E.g. there will be
incorrect language statements while the application built on top of the
server is being developed, but few to none afterwards (at least is
certainly hope so). So a failing query is a truly exceptional case.

Also, consider that a normal compiler usually compiles source files a
lot more often then you write them. Think of nightly builds, "ant clean
build", your co-workers checking your code out and compiling it etc. I
think under normal circumstances compiling source files should outweigh
those with errors.

Meaning: get rid of of exceptions for backtracking if you want to (we
don't use backtracking anyways, to be honest) but feel free to keep them
for failing source files. A file that is incorrect in terms of the
language is an exceptional case for a parser, and those exceptions are
valid.

Martin



More information about the antlr-interest mailing list