[antlr-interest] help with lexical nondeterminism
Terence Parr
parrt at jguru.com
Thu Feb 13 10:10:43 PST 2003
Ah right...this looks like a linear approx error. Damn...i guess "I
know what I'm doing this summer": LL(k) ;)
Break EXAMPLE1 into two rules and it should work.
Ter
On Thursday, February 13, 2003, at 07:46 AM, Alan Oursland wrote:
> Do you mean "Lexical lookahead and the end-of-token symbol"? That
> didn't
> help me understand why this example doesn't work.
>
> Each of the tokens ends with a ';' and none of them start with a
> semicolon.
> Shouldn't it be clear where the boundaries are?
>
> i.e.
> if( LA(1) == '+' ) {
> EXAMPLE1();
> }
> else if( LA(1) == '.' && LA(2) == '.' ) {
> EXAMPLE1();
> }
> else if( LA(1) == '.' && LA(2) == ';' ) {
> EXAMPLE2();
> }
>
> Alan
>
>> -----Original Message-----
>> From: Terence Parr [mailto:parrt at jguru.com]
>> Sent: Thursday, February 13, 2003 1:37 AM
>> To: antlr-interest at yahoogroups.com
>> Subject: Re: [antlr-interest] help with lexical nondeterminism
>>
>>
>> Hi. Please read the section in the manual about lookahead
>> computations
>> that go past the end of a token :)
>>
>> Ter
>>
>> On Wednesday, February 12, 2003, at 05:27 PM, Alan Oursland wrote:
>>
>>> Can anyone explain to me why I am getting the following lexical
>>> nondeterminism nondeterminism warning?
>>>
>>> ANTLR Parser Generator Version 2.7.2 1989-2003 jGuru.com
>>> sample.g: warning:lexical nondeterminism between rules EXAMPLE1 and
>>> EXAMPLE2
>>> upon
>>> sample.g: k==1:'.'
>>> sample.g: k==2:';'
>>> sample.g: k==3:<end-of-token>
>>>
>>> =====================================================================
>>> ==
>>> =
>>> class SampleLexer extends Lexer;
>>> options {
>>> k=3;
>>> }
>>>
>>> EXAMPLE1
>>> : "+;"
>>> | "..;"
>>> ;
>>> EXAMPLE2
>>> : ".;"
>>> ;
>>> =====================================================================
>>> ==
>>> =
>>>
>>> Thank you.
>>>
>>> Alan
>>>
>>>
>>>
>>>
>>>
>>> Your use of Yahoo! Groups is subject to
>>> http://docs.yahoo.com/info/terms/
>>>
>>>
>> --
>> Co-founder, http://www.jguru.com
>> Creator, ANTLR Parser Generator: http://www.antlr.org
>> Lecturer in Comp. Sci., University of San Francisco
>>
>>
>>
>>
>> Your use of Yahoo! Groups is subject to
>> http://docs.yahoo.com/info/terms/
>>
>>
>
>
>
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
--
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org
Lecturer in Comp. Sci., University of San Francisco
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list