[antlr-interest] Cannot display rule "X" because start state not found
John B. Brodie
jbb at acm.org
Fri Jul 15 11:56:01 PDT 2011
Greetings!
On Sat, 2011-07-16 at 05:03 +1100, Minhaz Zibran wrote:
>
> I am trying to learn ANTLR. I tried to invoke ANTLR v3.3 from
> command line (java -cp antlr-3.3-complete.jar org.antlr.Tool T.g) on
> the T.g, and found the following error message:
>
>
>
>
> error(10): internal error: Exception T.g:5:64: unexpected char:
the "T.g:5:64" portion of the error message is the location of the error
and means line 5 of file T.g in the 64th character position of that
line.
assuming that your T.g does not have blank lines between the rules, line
5 char 64 would be the very last character of the file (e.g. the last e
in whitespace).
does your file have a new-line as the very last character?
(i am speculating that you do not have a final new-line and that ANTLR
needs a new-line in order to mark the end of the "//" comment on your
last line).
i do not use ANTLRWorks, so can not speak to that issue, sorry.
hope this helps....
-jbb
(ps and, oh, by the way, I was unable to reproduce this error --- both
with and without final new-line --- using Ubuntu 11.04, Sun Java 6 and
the antlr-3.4-complete.jar file....)
> 'e'@org.antlr.grammar.v2.ANTLRLexer.nextToken(ANTLRLexer.java:346):
> unexpected stream error from parsing T.g
>
>
>
> When I open T.g in AntlrWorks 1.4.2 and select any rule I get the following error message:
>
>
>
> Cannot display rule "X" because start state not found
>
>
>
> However, the content of T.g is taken from page 29 of the book "The
> Definite ANTLR Reference: Building Domain specific Languages, by Terence
> Parr, 2007". T.g simply contains the following:
>
>
>
> grammar T;
>
> /** Match things like "call foo;" */
>
> r : 'call' ID ';' {System.out.println("invoke "+$ID.text);} ;
>
> ID: 'a'..'z'+ ;
>
> WS: (' '|'\n'|'\r')+ {$channel=HIDDEN;} ; // ignore whitespace
>
>
>
> My Question is, how can I resolve this issue, and what is start state?
>
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
More information about the antlr-interest
mailing list