I have a simple ANTLR grammar, which I have stripped down to its bare essentials to demonstrate this problem I'm having. I am using ANTLRworks 1.3.1.
grammar sample;
assignment : IDENT ':=' NUM ';' ;
IDENT : ('a'..'z')+ ;
NUM : ('0'..'9')+ ;
WS : (' '|'\n'|'\t'|'\r')+ {$channel=HIDDEN;} ;
Obviously, this statement is accepted by the grammar:
x := 99;
But this one also is:
x := @!$()()%99***;
Output from the ANTLRworks Interpreter:
What am I doing wrong? Even other sample grammars that come with ANTLR (such as the CMinus grammar) exhibit this behavior.