[antlr-interest] Lexing almost arbitrary input
mandy at think-a-lot.de
Sun Oct 28 07:06:30 PDT 2012
Thank you all very much for your input and estimations.
Unfortunately, I'm just a student assistent at our institute, so if my
professor and lecturers say "we wanna use antlr, go write us a grammar",
I have like not much choice. So I eventually tried.
The question for me now is: Are there compelling arguments AGAINST using
antlr in this case? Or is it just like "antlr is not made for this, but
you can nevertheless use it"? I would really appreciate if someone can
explain it to me, maybe from a language designer's view, in terms of the
theory of parser construction or sth. I'm really not an expert in this
field (just know the essence about lexing, parsing and formal grammars),
but I'd like to understand it in more detail and maybe get some
arguments to bring up against my colleagues.
Am 24.10.2012 19:11, schrieb Juancarlo Añez:
> 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.
> Juancarlo *Añez*
More information about the antlr-interest