Erlang/OTP Forums

Author Message

<  Erlang bugs mailing list  ~  Yecc bug (possibly related to mutually recursive rules)

Guest
Posted: Mon Mar 01, 2010 4:17 pm Reply with quote
Guest
This grammar file:

Nonterminals elem seq.
Terminals 'foo' 'bar' ':'.
Rootsymbol elem.
elem -> 'foo'.
elem -> 'bar'.
elem -> seq.
seq -> elem.
seq -> seq ':' elem.
% or seq -> elem ':' seq.

when fed to yecc (git version) produces this error:

2> yecc:file("bug.yrl").

=ERROR REPORT==== 1-Mar-2010::18:16:06 ===
Error in process <0.36.0> with exit value:
{function_clause,[{yecc,find_reduce_reduce,[[accept,{reduce,10,seq,1,{0,none},undefined}],{cxt,'$end',2,{yecc,"bug.yrl","bug.erl",[],{1,2},bug,[file_attributes,{includefile,[]},{parserfile,[]},report_errors,report_warnings],false...

** exception exit: function_clause
in function yecc:find_reduce_reduce/2
called as
yecc:find_reduce_reduce([accept,{reduce,10,seq,1,{0,none},undefined}],
{cxt,'$end',2,
{yecc,"bug.yrl","bug.erl",[],
{1,2},
bug,
[file_attributes,
{includefile,[]},
{parserfile,[]},

report_errors,report_warnings],
false,true,[],[],false,
[{1,':'}],
[],6,<0.37.0>,<0.38.0>,1,

[{0,[{...}|...]},{1,[...]},{2,...},{...}|...],
16400,20497,[],32786,...},
[]})
in call from yecc:'-find_action_conflicts/1-fun-0-'/3
in call from lists:foldl/3
in call from yecc:'-find_action_conflicts/1-fun-1-'/2
in call from lists:foldl/3
in call from yecc:find_action_conflicts/1
in call from yecc:action_conflicts/1
in call from yecc:'-generate/1-fun-8-'/3

When I stumbled on this, I figured It's easy to achieve the intended
behavior without using a separate non-terminal, simply by declaring
the separator as a left- (or right-) associative operator - and the
resulting grammar file compiles normally.

________________________________________________________________
erlang-bugs (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-bugs-unsubscribe@erlang.org

Post received from mailinglist
Hans Bolinder
Posted: Tue Mar 02, 2010 11:20 am Reply with quote
User Joined: 05 Nov 2008 Posts: 24 Location: Stockholm
[Manolis Papadakis:]
> This grammar file:
>
> Nonterminals elem seq.
> Terminals 'foo' 'bar' ':'.
> Rootsymbol elem.
> elem -> 'foo'.
> elem -> 'bar'.
> elem -> seq.
> seq -> elem.
> seq -> seq ':' elem.
> % or seq -> elem ':' seq.
>
> when fed to yecc (git version) produces this error:
>
> 2> yecc:file("bug.yrl").
...
> ** exception exit: function_clause
> in function yecc:find_reduce_reduce/2
> called as
> yecc:find_reduce_reduce([accept,{reduce,10,seq,1,{0,none},undefined}],
...

Thanks. The bug will be fixed in R14A.

In the meantime, to get the error report, you can add a dummy rule:

Rootsymbol RS.
RS -> elem.

Best regards,

Hans Bolinder, Erlang/OTP team, Ericsson

________________________________________________________________
erlang-bugs (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-bugs-unsubscribe@erlang.org

Post received from mailinglist
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum