I just can't get how I can left-refactor the following grammar. Please,
help.
Currently I get "(211): ebnf.g:1:8: [fatal] rule Tokens has non-LL(*)
decision due to recursive rule invocations reachable from alts 8,9. Resolve
by left-factoring or using syntactic predicates or using backtrack=true
option." error with it.
grammar ebnf;
options {
output = AST;
language = CSharp2;
}
tokens {
OPENBRACKET = '(';
CLOSEBRACKET = ')';
ONEORMOREKEYWORD= '+';
ANYKEYWORD = '*';
OPTIONALKEYWORD = '?';
ORKEYWORD = '|';
}
/*------------------------------------------------------------------
* PARSER RULES
*------------------------------------------------------------------*/
OrList : List (ORKEYWORD List)*;
List : (Mutliplication)+;
Mutliplication : Atom ( ONEORMOREKEYWORD | OPTIONALKEYWORD | ANYKEYWORD )?;
Atom : IDENTIFIER | Group;
Group : OPENBRACKET OrList CLOSEBRACKET;
/*------------------------------------------------------------------
* LEXER RULES
*------------------------------------------------------------------*/
IDENTIFIER : (DIGIT)+ ;
WHITESPACE : ( '\t' | ' ' | '\r' | '\n' )+ { $channel = HIDDEN; } ;
fragment DIGIT : '0'..'9' ;
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address