[antlr-interest] Interpreter results misunderstanding...

Fabien Antoine fab.antoine at gmail.com
Thu Feb 11 04:36:20 PST 2010


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


More information about the antlr-interest mailing list