Re: Unexpected reduce/reduce conflicts
- From:
- José Valim
- Date:
- 2011-08-07 @ 17:31
FWIW, I have opened an issue in Jison's issues tracker that may be a
possible solution to this problem:
https://github.com/zaach/jison/issues/56
On Sun, Aug 7, 2011 at 2:10 PM, José Valim <jose.valim@gmail.com> wrote:
> Hello!
>
> I am having unexpected reduce/reduce conflicts.
> I have tried it in yecc (Erlang's version of yacc) and it yields no
> conflicts.
> Could someone please help me understand what is going on here and how to
> solve it?
>
> Here is the grammar:
>
> expressions : stat EOF ;
>
> stat : NAME '=' exp | functioncall;
>
> exp : NULL | prefixexp;
>
> prefixexp : var | functioncall | '(' exp ')';
>
> functioncall : prefixexp '(' exp ')';
>
> The reduce conflict is this:
>
> stat -> functioncall . #lookaheads= EOF (
> prefixexp -> functioncall . #lookaheads= EOF (
>
> I have also put this stuff in a gist, in case someone wants to read it
> there: https://gist.github.com/f22bae54839fe93bf297
>
> As far as I know, the grammar above does not allow "stat (", so we
> shouldn't have an issue with "(" lookahead. Also "prefixexp EOF" is only
> allowed after the token "=", so in theory, we shouldn't have any conflict.
>
> Btw, thanks for the great tool. It certainly pushes the JS community
> forward!
>
> # José Valim
>