[erlang-questions] Yecc bug-report

Hans Bolinder <>
Thu Dec 7 15:09:33 CET 2006


[datacompboy:]
> 
> On compilation this:
> %========================
> Nonterminals cmp compare expr.
> Terminals 'string' '>' '='.
> Rootsymbol compare.
> Nonassoc 250 cmp.
> compare -> expr cmp expr	: {cmp, '$2', '$1', '$3'}.
> compare -> expr 		: {cmp, '==', '$1', {string, "TRUE"}}.
> cmp -> '>' '='			: '>='.
> cmp -> '>'			: '>'.
> expr -> 'string'		: '$1'.
> %========================
> 
> We got that:
> =ERROR REPORT==== 7-Dec-2006::12:53:22 === Error in process <0.1667.0>
> on node '' with exit value:
> {{badmatch,{shift,5,{250,nonassoc}}},[{yecc,find_action_conflicts2,2},...

Thanks for the bug report. Could you please try the following patch:

*** /usr/local/otp/releases/otp_beam_solaris8_r11b_patched/lib/parsetools-1.4/src/yecc.erl	Wed May 17 01:31:14 2006
--- yecc.erl	Thu Dec  7 14:52:48 2006
***************
*** 1448,1461 ****
              case is_terminal(St#yecc.symbol_tab, Symbol) of
                  true ->
                      DecSymbol = decode_symbol(Symbol, St#yecc.inv_symbol_tab),
-                     Prec1 = case rule(RulePointer, St) of
-                                 {[Head, DecSymbol], _RuleLine, _} ->
-                                     get_prec([Head, DecSymbol], St);
-                                 _ ->
-                                     get_prec([DecSymbol], St)
-                             end,
                      [{[DecSymbol],
!                       #shift{state = goto(N, DecSymbol, St), prec = Prec1}}
                       | compute_parse_actions1(Items, N, St)];
                  false ->
                      compute_parse_actions1(Items, N, St)
--- 1448,1456 ----
              case is_terminal(St#yecc.symbol_tab, Symbol) of
                  true ->
                      DecSymbol = decode_symbol(Symbol, St#yecc.inv_symbol_tab),
                      [{[DecSymbol],
!                       #shift{state = goto(N, DecSymbol, St), 
!                              prec = get_prec([DecSymbol], St)}}
                       | compute_parse_actions1(Items, N, St)];
                  false ->
                      compute_parse_actions1(Items, N, St)

Best regards,

Hans Bolinder, Erlang/OTP



More information about the erlang-questions mailing list