Gavin Lambert wrote:
> At 13:41 11/12/2009, Duygu Altinok wrote:
>> INT : (DIGIT )+
>> ;
>>
>> FLOAT
>> : ('0'..'9')+ '.' ('0'..'9')* (EXPONENT)?
>> | '.' ('0'..'9')+ (EXPONENT)?
>> | ('0'..'9')+ EXPONENT
>> ;
>
> These two rules have a common left prefix, and are thus
> ambiguous. Even ANTLR v3 with * lookahead has trouble with this;
> ANTLR v2's fixed (typically small) lookahead doesn't stand a
> chance.I thought lexer rules were supposed to find the longest match? How can they do that if they're unable to handle common left prefixes? (I have the impression that "longest match" may not be quite accurate, but if so, I've never seen the actual behaviour documented precisely.) -- David-Sarah Hopwood ⚥ http://davidsarah.livejournal.com
signature.asc
Description: OpenPGP digital signature
List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
