[antlr-interest] Interpreter results misunderstanding...

Fabien Antoine fab.antoine at gmail.com
Mon Feb 15 05:40:08 PST 2010


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
>   



More information about the antlr-interest mailing list