[antlr-interest] A rule can be mutually left-recursive with itself?

Jeremy Sheldon Jeremy.Sheldon at 90degreesoftware.com
Fri Sep 28 14:06:39 PDT 2007


>It would probably be easier to explain if you posted the rule it 
>was complaining about.

Here's the error message:

[14:00:29] Aborting because the following rules are mutually
left-recursive:
    [table_reference]
    [non_join_query_term]

Now, there are two rules listed there, but always in the past, the form
of the error message would be something like the following:

[14:00:29] Aborting because the following rules are mutually
left-recursive:
    [table_reference, foo, bar]

This leads me to believe that table_reference and non_join_query_term
are not mutually left-recursive with each other.  Would this assumption
be correct?

Here are the rules themselves:

table_reference
	: table_name  correlation_specification?
	| derived_table correlation_specification
	| (table_reference CROSS JOIN table_reference
	| table_reference NATURAL? join_type? JOIN table_reference
join_specification?
	| LEFT_PAREN joined_table RIGHT_PAREN);


non_join_query_term
        : (non_join_query_term | joined_table) INTERSECT ALL?
corresponding_spec? query_primary
        |  non_join_query_primary;

Thanks again,
Jeremy



More information about the antlr-interest mailing list