[antlr-interest] (no subject)

Gavin Lambert antlr at mirality.co.nz
Tue Aug 7 02:14:32 PDT 2007


At 15:32 7/08/2007, Cameron Esfahani wrote:
>error(210):  The following sets of rules are mutually 
>left-recursive [exclusive_or_expression, unary_expression, 
>primary_expression, shift_expression, inclusive_or_expression, 
>numeric_expression, and_expression, cast_expression, 
>multiplicative_expression, additive_expression, 
>postfix_expression]
>
>Here is the portion from the parser grammar:
>
>numeric_expression
>:inclusive_or_expression
>;
[...]
>primary_expression
>:number_size -> ^( T_NUM number_size )
>|'('! whitespace! numeric_expression whitespace! ')'!
>;
>
>and here is the portion from the tree grammar:
>
>numeric_expression
>:inclusive_or_expression
>;
[...]
>primary_expression
>:^( T_NUM number_size )
>|numeric_expression
>;

This looks like the problem.  primary_expression can be the first 
component of numeric_expression, and numeric_expression can be the 
first component of primary_expression.  That's mutual left 
recursion right there.

Since the output of your grammar rule is a T_NUM, that's what you 
should be looking for in the tree grammar, not jumping back up to 
numeric_expression. 



More information about the antlr-interest mailing list