[antlr-interest] Lexing almost arbitrary input

Juancarlo Añez apalala at gmail.com
Wed Oct 24 10:11:40 PDT 2012


Mandy,

I also know that this sounds like a very strange task for ANTLR, but
> my colleagues and boss say we need the fancy error reporting and AST
> creation stuff...
>

That is not what characterizes ANTLR, and is something easy to have with
other approaches.

Your source language is not even recursive, so the ASTs that ANTLR would
produce for it are dead simple, a list of tuples perhaps.

Despite the power of ANTLR, there exist languages that can be described in
plain English or in mathematical notation but that an ANTLR grammar cannot
parse. Ill defined, or very ambiguous languages are among them.

My suggestion is that you hand-write a top down parser for your small
language. It will not only work, but it will become a formal definition for
the language, which is something I think you're missing so far.

Cheers,

-- 
Juancarlo *Añez*


More information about the antlr-interest mailing list