[antlr-interest] Cannot display rule "X" because start state not found

Minhaz Zibran zibranm at hotmail.com
Fri Jul 15 11:03:18 PDT 2011



    

        



    


          
    
        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: 
'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?

     		 	   		  


More information about the antlr-interest mailing list