I'm doing something wrong
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Timo_Hanisch
Posted On:   Sunday, March 20, 2011 06:04 AM

Hey, the last days I tried to get around with with ANTLR, got in touch with a lot of tutorials etc. Now I've started a own project, but get an anoying error: [fatal] rule functionBlock has non-LL(*) decision due to recursive rule invocations reachable from alts 1,2. Resolve by left-factoring or using syntactic predicates or using backtrack=true option. |---> (field)* I don't know how to deal with it. I tracked it down to 2 rules (my guess: antlr doesn't know which one it should choose) Here the code snippet: functionBlock //ERROR : LBRACE (field)* (statement)* RBRACE ;    More>>

Hey,



the last days I tried to get around with with ANTLR, got in touch with a lot of tutorials etc.
Now I've started a own project, but get an anoying error:




			
[fatal] rule functionBlock has non-LL(*) decision due to recursive rule invocations reachable from alts 1,2. Resolve by left-factoring or using syntactic predicates or using backtrack=true option.
|---> (field)*


I don't know how to deal with it. I tracked it down to 2 rules
(my guess: antlr doesn't know which one it should choose)


Here the code snippet:


			

functionBlock //ERROR
: LBRACE
(field)*
(statement)*
RBRACE
;

returnStatement
: RETURN expression? SEMI
;

struct
: STRUCT IDENT structBlock SEMI
;

structBlock
: LBRACE (field)+ RBRACE
;

field
: CONST type (arrayDecl)* IDENT EQ expression
SEMI
| type IDENT (EQ expression)? SEMI
| type (arrayDecl)+ IDENT SEMI
;

//field and assignmentStatement are the problems, I think.
assignmentStatement
: IDENT assignSymbol expression SEMI
| IDENT (arrayDecl)+ assignSymbol expression SEMI
;

type
: primitiveType
| IDENT
;


So I noticed it has to do with the field and assignmentStatement rules...
could someone tell me what I'm doing totally wrong?
thanks for help :)

   <<Less
About | Sitemap | Contact