[antlr-interest] beginner's question

jinsong Li ljs_aaaa at yahoo.com
Wed Jul 11 23:07:52 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!








       
____________________________________________________________________________________
Yahoo! oneSearch: Finally, mobile search 
that gives answers, not web links. 
http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC


More information about the antlr-interest mailing list