[antlr-interest] Difference in the following rules
Paul Johnson
gt54-antlr at cyconix.com
Tue Jul 12 01:10:05 PDT 2005
Ric Klaren wrote:
> Hi,
>
> On 7/11/05, Tarun Khanna <tarunkhanna at gmail.com> wrote:
>
>>The attached grammar produces a non-determinism warning in the following
>>production
>> factor :
>> ( ( LPAREN exp RPAREN ) | IDENT ) (DOT IDENT)* (DOT TAB)?
>> |
>> TAB
>> ;
>
>
> Notice that the (DOT IDENT)* may match the empty word e.g. nothing.
> Add to that that (DOT TAB)? may also match nothing. Add to that that
> the start of both may be a DOT. So antlr has a hard time choosing
> between the closure (DOT IDENT)* and the optional part (DOT TAB)?.
But what if k is 2, as Tarun said in his original post?
Paul
More information about the antlr-interest
mailing list