[antlr-interest] Cannot understand why parser accepts input...

Bern.McCarty at bentley.com Bern.McCarty at bentley.com
Thu Dec 6 20:45:38 PST 2007


Why does the below grammer successfully parse the input " B ==3C" When
there are no numerals allowed anywhere in the grammer?

grammar BoolExpr;

top	:
	expr EOF
	;

expr	: 
	unaryExp | equalityExp
	;

unaryExp:	
	'!' equalityExp
	;

equalityExp	:
	andOrExpr (('=='|'!=') andOrExpr)*
	;

andOrExpr
	:	atom (('||'|'&&') atom)*
	;

atom	:
	|	ID
	|	'(' expr ')'
	;

ID	:	('A'..'Z')+
	;

WS  	:  (' '|'\r'|'\t'|'\u000C'|'\n') {$channel=HIDDEN;}
    	;



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20071206/7a017c10/attachment.html 


More information about the antlr-interest mailing list