[antlr-interest] beginner's question

jinsong Li ljs_aaaa at yahoo.com
Wed Jul 11 23:03:43 PDT 2007


Hi,
   I have a simple grammar like this:

prog :	statement+;
statement :	'int' ID '=' INT ';'
	|	'int' ID ';'
	;
ID	:
('a'..'z'|'A'..'Z'|'_')('a'..'z'|'A'..'Z'|'_'|'0'..'9')*
;
INT	:	'0'..'9'+;
WS  :   (' '|'\t'|'\n'|'\r')+ {Skip();} ;

I am expecting it matches the lines like
...
int x=10;
int m;
...

It does recognize these line,
but what wired is, if I put the input like this:
int x=10;
zint m;

I am expecting antlr give an error on "zint", but when
looking at the generated code, it simply ignore what
can be match and quit.

Is this by design or I am doing/expecting something
stupid?

Thanks for the help!








       
____________________________________________________________________________________
Choose the right car based on your needs.  Check out Yahoo! Autos new Car Finder tool.
http://autos.yahoo.com/carfinder/


More information about the antlr-interest mailing list