[antlr-interest] Undocumented error message

William B. Clodius wclodius at los-alamos.net
Thu Oct 8 21:10:21 PDT 2009


As a hobby I have started using ANTLR V3 to design a language. So far  
I am at the pure syntax stage, building up a grammar that is intended  
to be pure LL(*), in the expectation that it will allow me to provide  
more specific and clearer error messages than is typically provided by  
an LR(n) parser. I have so far not deliberately added actions,  
syntactic predicates, etc. Today I have been getting error messages in  
the console of ANTLR-Works 1.3 for which I have found no documentation  
on the net. Yesterday I downloaded the most recent upgrade so I  
suspect the message was added in the recent upgrade. I also have a  
question about the general syntax of the messages. The message is of  
the form

[20:55:24] error(130): ...:163:15: rule comparison has no defined  
parameters

where comparison is my name for the syntactic rule for relational  
expressions, and ... represents the name of my grammar file. It turned  
out that I had misremembered ANTLR's EBNF syntax and had used square  
brackets as delimiters. However I did not use them in the comparison  
rule, but rather in the immediately following rule. Further the 163  
was not the line number of the start of the comparison rule, or the  
following rule, but the line with the colon of the following rule.  
This leads to the following questions:

First, what kind of parameters are expected for a rule in ANTLR and  
how do I define them?

Second the error messages have a regular syntax for which I have seen  
no definition. What is the meaning of the numbers in  [20:55:24]? I  
had thought that the number where the 163 appears was the line number  
of the start of the error, is it? What is the meaning of the number  
15? Is there someplace error(130) is documented?



More information about the antlr-interest mailing list