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

Sun Aug 4 00:03:07 CEST 2013

2> yecc:file("test",[]).
test.yrl: Warning: conflicts: 111 shift/reduce, 0 reduce/reduce
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...).
snip... snip

yeccpars2_24(_, _, _, _, T, _, _) ->

snip... snip

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

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

snip... snip

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

snip... snip
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