zaach / jison

Bison in JavaScript.
http://jison.org
4.36k stars 450 forks source link

grammar conflict in LALR, but works in SLR and LR(1). Bison also works. #342

Open pjincz opened 7 years ago

pjincz commented 7 years ago

Hi friend, Thank you for your awesome project.

I wrote a jison file, but it not works. After all, I got following snippet to reproduce the problem.

%token ID

%%

stmt
    : type ID ';'
    | expr ';'
    ;

type
    : ID
    ;

expr
    : ID
    ;

This snippet works fine in SLR and LR. Also works fine in BISON (both LALR, IELR, LR) I'm a new of yacc, I can not found out where the problem is. But due to BISON and SLR work fine. I think maybe this is an issue.

Can you help me?

Thank you

GerHobbelt commented 7 years ago

Yes, it is. This is the same problem as #205. Looking into it.

On Feb 1, 2017 9:50 PM, "Chizhong Jin" notifications@github.com wrote:

Hi friend, Thank you for your awesome project.

I wrote a jison file, but it not works. After all, I got following snippet to reproduce the problem.

%token ID

%%

stmt : type ID ';' | expr ';' ;

type : ID ;

expr : ID ;

This snippet works fine in SLR and LR. Also works fine in BISON (both LALR, IELR, LR) I'm a new of yacc, I can not found out where the problem is. But due to BISON and SLR work fine. I think maybe this is an issue.

Can you help me?

Thank you

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/zaach/jison/issues/342, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYkHjU4NY1fDfHqvnkmzv82_Y32dblwks5rYPAqgaJpZM4L0XrO .

GerHobbelt commented 7 years ago

Provisionally fixed in the https://github.com/GerHobbelt/jison fork in the next build. (Have to nail #343 before this build/release will be available!)

See commits:

pjincz commented 7 years ago

:) Thank you very much