[antlr-interest] unrelated rule causing warnings

Ian Moor iwm at doc.ic.ac.uk
Wed Jul 23 02:51:44 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
>
The problem is that 'a'  is either  a column_reference or a qualified_name
   Ian Moor



More information about the antlr-interest mailing list