[antlr-interest] Simple grammar will not compile. I can't figure it out.

Stevenson, Todd (GE Healthcare, consultant) ToddStevenson at ge.com
Wed Mar 11 10:17:22 PDT 2009


This grammar will not compile.  I can't figure out why not.  It
generates the error:
 
reference to undefined rule: keypath
 
even though it exists.  Help!
 
Thanks.
 
------------------------------------------------------------------------
------------------------------------------------
grammar cepath;
 
options {
 output=AST;
 ASTLabelType=CommonTree; 
}
 
 
 
start
 : cpath EOF
 ;
 
cpath 
 : KEY keypath
 | DataPath
 ; 
 
DataPath
 : CODE keypath
 ;
 

keypath
 : SEP CODE 
 | SEP DOMAIN
 ;
 

// $<lex
 
KEY    : 'key';
CODE   : 'code';
DOMAIN   : 'domain';
 

SEP  : '.';
WS   :  ( '\r' | '\n')+ {skip();};
 
// $>
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090311/4e443f7b/attachment.html 


More information about the antlr-interest mailing list