[antlr-interest] Interpreter results misunderstanding...

Terence Parr parrt at cs.usfca.edu
Mon Feb 15 10:39:36 PST 2010


the interp has some flaws ;)
T
On Feb 15, 2010, at 5:40 AM, Fabien Antoine wrote:

> Hum...my question seems to be forgotten.
> I don't think that's a difficult thing but a simple explanation of this
> could be great!
> 
> Fabien
> 
> On 11/02/2010 13:36, Fabien Antoine wrote:
>> Hi list,
>> 
>> I'm a new user of this great tool and I don't understand some things
>> with the interpreter...
>> I've the following grammar:
>> 
>> grammar Test;
>> options {
>>    backtrack    = true;
>>    memoize        = true;
>> }
>> 
>> testOK
>>    :    ID
>>    |    INT
>>    ;
>> 
>> testKO
>>    :    testID
>>    |    testINT
>>    ;    
>> testID
>>    :    ID
>>    ;    
>> testINT
>>    :    INT
>>    ;
>> 
>> ID  :    ('a'..'z'|'A'..'Z')+
>>    ;    
>> INT :    ('0'..'9')+
>>    ;
>> 
>> 
>> And then when I write the text "test" in the interpreter it works fine
>> with "testOK" and I get a FailedPredicateException exception with "testKO".
>> There are some explanations to this feature because for me it should be
>> the same thing?
>> 
>> Thanks for your answers!!
>> 
>> Fabien
>> 
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list