[antlr-interest] simple rules not deterministic
Mark Volkmann
r.mark.volkmann at gmail.com
Tue Oct 9 10:06:53 PDT 2007
When I generate code from my grammar I get a warning I don't
understand that says "Decision can match input such as "NAME" using
multiple alternatives: 1, 2". This is on the line that defines
methodCall.
Here's a snippet of my grammar.
methodCall: t=target p=parameter* -> ^(CALL $t $p);
objectReference: 'me' | NAME;
parameter: variableDef;
target: objectReference | CLASS_NAME;
type: 'integer' | 'float' | 'text' | 'yesno';
variableDef: NAME (':' type)?;
CLASS_NAME: UPPERCASE_LETTER (LETTER | DIGIT)*;
NAME: LOWERCASE_LETTER (LETTER | DIGIT)*;
I see that NAME matches both target and parameter, but target is
required and parameter is optional. I don't understand why this isn't
deterministic.
--
R. Mark Volkmann
Object Computing, Inc.
More information about the antlr-interest
mailing list