[antlr-interest] unrelated rule causing warnings
Sean Bridges
sean.bridges at gmail.com
Wed Jul 23 09:26:08 PDT 2008
'a' may match two rules, but given a start rule, isn't there always
only one way to parse 'a'?
The grammar also compiles without warning if I remove the from_clause
rule, which confuses me since from_clause does not refer to
column_reference.
Thanks,
Sean
On Wed, Jul 23, 2008 at 2:51 AM, Ian Moor <iwm at doc.ic.ac.uk> wrote:
>>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