[antlr-interest] NoViableAltException
Johannes Bittner
johannes.bittner at gmail.com
Sun Dec 13 11:49:13 PST 2009
Hello,
The Java code generated for the following grammar produces a
NoViableAltException when using "void foo (int a, int b) { foo }" as
input, i.e. when the second token is "foo", it works otherwise. I
tried this with antlrworks 1.3.1. Could somebody clearify why this
happens?
Thanks, Johannes
method
: type ID '(' args ')' ';'
| type ID '(' args ')' '{' 'foo' '}'
;
type: 'void' | 'int';
args: arg (',' arg)*;
arg: 'int' ID;
ID : ('a'..'z'|'A'..'Z')+ ;
INT : '0'..'9'+ ;
WS : (' '|'\t'|'\r'|'\n')+ {skip();} ;
More information about the antlr-interest
mailing list