[antlr-interest] Variable Declaration problem: 'FailedPredicateException' while testing the rule.
Adam Adamski
thebigsmalln at gmail.com
Fri Jul 29 07:25:29 PDT 2011
Hello,
I am trying to create parser for object-oriented language - Loglan82. I
am also quite new to ANTLR and I have an error at the very beginning.
I get: FailedPredicateException while I am using Interpeter (Eclipse
plugin) to check if parser is recognizing 'varDecl'.
This kind of declaration is valid in Loglan82: 'var
you,are:integer,totally,correct:Type2;'
And here are my gammar rules:
varDecl: VAR IDENT (COMMA IDENT)* COLON type (COMMA IDENT (COMMA IDENT)*
COLON type)*;
type: ARRAY* (systemType | simpleType | IDENT);
systemType: PROCES | COROUTINE;
simpleType: INTEGER | REAL | BOOLEAN | CHARACTER | STRING | FILE |
SEMAPHORE;
I get error when parser meets first comma (',') after 'you' identifier.
I am using Antlr 3.3v and all necessary Eclipse plugins.
Grammar options backtrack=true and memoize=true.
When I write this kind of rule: 'var you:Type2;' everything is correct.
I think this might be problem of '*' and lookahead - but I am not sure.
What might cause the problem? How this can be fixed?
Thank you for your time,
Adam.
More information about the antlr-interest
mailing list