[antlr-interest] Lexing almost arbitrary input
apalala at gmail.com
Sun Oct 28 08:06:27 PDT 2012
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.
What I tried to say was that a good part of the problem you're having with
ANTLR is that your language is not well defined.
You can keep banging your head against ANTLR nuances for weeks, or you can
spend a day or two hand-writing a top-down parser, and *then* come back to
ANTLR with the gained knowledge.
I've taught language theory at the university level, so I know what
students have to cope with. You need to start with a description of a
language that's unambiguous; then you can translate that to an ANTLR
grammar. If you can't parse your small language with a hand-written
program, then ANTLR won't be able to parse it either. ANTLR doesn't do
magic, it just builds an automaton based on a specification.
More information about the antlr-interest