[antlr-interest] Mutual left recursion rmoval help!!
Terence Parr
parrt at cs.usfca.edu
Wed May 6 13:59:17 PDT 2009
thanks...found this myself...submitted a bug report.
Ter
On May 6, 2009, at 1:45 PM, babak.teymouri at noos.fr wrote:
>
>
> 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
> : ;
>
>
>
>
>
>
>
>
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
More information about the antlr-interest
mailing list