[antlr-interest] "No Past Experience Required"

Peter Boughton boughtonp at gmail.com
Fri Oct 16 14:28:00 PDT 2009


Hi all,

I'm looking to figure out ANTLR and so I'm reading this page:
http://www.antlr.org/wiki/display/ANTLR3/Quick+Starter+on+Parser+Grammars+-+No+Past+Experience+Required

But there are a number of things I'm stuck on - and so I'm asking here
for both a good explanation and so that someone with edit permission
can hopefully update the wiki page to actually be "no past experience"
and more helpful for future newbies.


"Left recursion."
Maybe it's me being dim, but it took me a while to figure how "a : a B
| C ;" translated to "a : C B*;" - and whilst I get it now, perhaps a
quick sentence to explain the transition might be helpful for the wiki
page?


"syntactic predicates"
So, they're an advanced category discussed in a book... yippee! I
don't have the book, and the absolute earliest I could get it (if I
choose to) is Tuesday, so that's not particularly helpful. If they're
going to be mentioned, they should at least have a brief explanation
of when they apply, and preferably a link to an online resource that
covers them.
(I tried reading the Wikipedia article, but that waffles on without
being very helpful.)

Can anyone provide [a link to] a good, concise definition of syntactic
predicates and semantic predicates and any other terms like this - for
that matter, is there a good online glossary for all this sort of
compiler/parser related stuff?


"Difference between lexer and parser rules"
This whole paragraph leaves me going "wha?". I don't know what the
difference between a lexer and a parser is, so attempting to explain
the difference between their rules doesn't mean much yet.

There's a vague suggestion that lexers look at literals (whether
explicit or combined via multiple rules), and parsers look at
everything else, but even then I'm not sure I get the implications of
that?

What's a symbolic name?

In the example, what does the "EQUALS='=';" syntax do? Should that be
a colon, or is something else happening?
What about IMAGINERY_TOKEN - what's that doing?

I'm now confused about tokens and non-terminal symbols - they are
obviously different, but how?

In the example for "How to build a grammar from a language
specification", the FILE rule is not in the tokens section
Does that make it a non-terminal symbol?
Is this example grammar handled by a lexer or a parser or both?


I do have some other questions, but they're not directly related to
the wiki page, so I'll leave them for a later email, once I have a
better idea of what's what.


Thanks,

Peter


More information about the antlr-interest mailing list