Hi,

working on a huge grammar ( approx 1300 rules) , I hit several mutual left-recursion situation.
Following the wiki (thanks to Johannes Luber), I removed the Mutual Left-recursed rules.
at the end, I have an error message from Antlr that indicates a Mutual left-recursion on 1 rule:

[22:21:26] Checking Grammar...
[22:21:26] error(210):  The following sets of rules are mutually left-recursive [value_expression_primary]
[22:21:26] Aborting because the following rules are mutually left-recursive:
    [[T.value_expression_primary,index=2,line=16]]
[22:21:26] java.lang.ClassCastException: org.antlr.tool.Rule cannot be cast to java.lang.String
    at org.antlr.works.grammar.antlr.ANTLRGrammarEngineImpl.markLeftRecursiveRules(Unknown Source)
    at org.antlr.works.grammar.antlr.ANTLRGrammarEngineImpl.analyze(Unknown Source)
    at org.antlr.works.grammar.engine.GrammarEngineImpl.analyze(Unknown Source)
    at org.antlr.works.grammar.CheckGrammar.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)



here is the extract of the grammar, any help will be greatly appreciated:
Babak

grammar T ;

tokens {
LEFT_PAREN ='(' ;
RIGHT_PAREN = ')';
CONCATENATION_OPERATOR = '||' ;
LEFT_BRACKET_OR_TRIGRAPH = '[' ;
RIGHT_BRACKET_OR_TRIGRAPH = ']' ;
PERIOD = '.' ;
}

start
    :     value_expression_primary EOF ;


value_expression_primary :
(LEFT_PAREN value_expression RIGHT_PAREN
| unsigned_value_specification
| column_reference
| set_function_specification
| window_function
| scalar_subquery
| case_expression
| cast_specification
| subtype_treatment
| value_expression_primary PERIOD method_name sql_argument_list?
| generalized_invocation
| static_method_invocation
| new_specification
| reference_resolution
| collection_value_constructor
| multiset_element_reference
| routine_invocation
| next_value_expression
)
(PERIOD field_name
| dereference_operator qualified_identifier sql_argument_list?
| (CONCATENATION_OPERATOR value_expression_primary)* LEFT_BRACKET_OR_TRIGRAPH numeric_value_expression RIGHT_BRACKET_OR_TRIGRAPH
)* 
;

numeric_value_expression
    :    ;
   
qualified_identifier
    :    ;
dereference_operator
    :    ;
field_name
    :    ;
value_expression
    :    ;
unsigned_value_specification
    :    ;

column_reference:;

set_function_specification
    :    ;
window_function
     :        ;
scalar_subquery
     :        ;
case_expression
     :        ;
cast_specification
     :        ;
subtype_treatment
     :        ;        
sql_argument_list
    :            ;
generalized_invocation
    :            ;
static_method_invocation
    :            ;
new_specification
    :            ;
reference_resolution
    :            ;
collection_value_constructor
    :            ;
multiset_element_reference
    :            ;
routine_invocation
    :            ;
next_value_expression     :        ;

method_name
    :    ;
   









--~--~---------~--~----~------------~-------~--~----~
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

Reply via email to