[erlang-bugs] R17A - Bug : unwanted semi-colon in generated erlang module after yecc compilation.

PAILLEAU Eric eric.pailleau@REDACTED
Sun Aug 4 00:03:07 CEST 2013


2> yecc:file("test",[]).
test.yrl: Warning: conflicts: 111 shift/reduce, 0 reduce/reduce
{ok,"test.erl"}
3> c:c("test").
test.erl:1167: syntax error before: ';'

Yes, the generated test.erl have a semi-colon before yeccerror .
(compilation ok by removing it...).
--8<-------------------------------------------------
snip... snip

;
yeccpars2_24(_, _, _, _, T, _, _) ->
 yeccerror(T).

snip... snip
--8<-------------------------------------------------

in lib/parsetools/src/yecc.erl
the problem comes from delim/2 function called in
output_state_actions_fini/2
--8<-------------------------------------------------
snip... snip

output_state_actions_fini(State, St0) ->
    %% Backward compatible.
    St10 = delim(St0, false),
    St = fwrite(St10, <<"yeccpars2_~w(_, _, _, _, T, _, _) ->\n">>,
[State]),
    fwrite(St, <<" yeccerror(T).\n\n">>, []).

snip... snip

delim(St, true) ->
    St;
delim(St, false) ->
    fwrite(St, <<";\n">>, []).

snip... snip
--8<-------------------------------------------------
May be the delim/2 function should get 'true' as second argument,
but the global code is a bit hard to understand and I suppose
the author should be a better bugfixer... furtherover, I go in vacation
and won't have time to look at this ;>) .

comments indicates changes on yeccerror() in yecc.erl since 1.4,
parsetools-2.0.4 . May be this introduce this bug.

Helas, so far, I can't say if this bug is a consequence of my parser or not.

I get same error with R16B01 .

best regards.



More information about the erlang-bugs mailing list