[antlr-interest] Antlr syntax reference

Sam Kuper sam.kuper at uclmail.net
Tue Jun 24 07:12:16 PDT 2008


Dear all,

I am looking for an exhaustive guide to Antlr 3.0.1 syntax (I am using
AntlrWorks 1.1.7); I'll explain why. My grammar so far looks like this:

grammar DCP;
options {
    language=Python;
}
dcp     : DOCUMENT* EOF;
DOCUMENT    : HEADERS;
HEADERS    : YEAR_HEADER MONTH_HEADER ;
YEAR_HEADER    : '*Y 18\n';
MONTH_HEADER    : '*M October\n';

Notice that in this grammar, I have used \n to denote new lines. But
although I have not declared what \n is, Antlr's lexical analyser recognises
that it denotes a newline; in other words, \n is a pre-defined token in
Antlr grammar. I'm guessing there are others, and I want to be conscious of
them as I work, but I have so far been unable to find a document that lists
all the pre-defined tokens in Antlr's grammar. Presumably one exists
somewhere. If you know where, please could you tell me?

Many thanks,

Sam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080624/9798a251/attachment.html 


More information about the antlr-interest mailing list