[antlr-interest] unrelated rule causing warnings

Sean Bridges sean.bridges at gmail.com
Tue Jul 22 11:30:47 PDT 2008


Hello,

This is a simplified version of the grammar I am working on.

grammar Test;

//comment out from_clause
//and warning in qualified_name
//goes away
from_clause
       :       'FROM' qualified_name ;

column_reference
       :       (qualified_name PERIOD)? 'a';

qualified_name
       :       ('a' PERIOD)? 'a';

PERIOD  :       '.';

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



When I compile this with antlr 3 (or 3.1 beta) I get a warning for the
qualified_name rule,

 warning(202): Test.g:13:4: the decision cannot distinguish between
alternative(s) 1,2 for at least one input sequence

If I comment out the from_clause rule, the grammar compiles without warning.

Is my grammar ambiguous?  How does adding/removing the from_clause
rule change the ambiguity of the qualified_name rule?

Thanks,

Sean


More information about the antlr-interest mailing list