help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

shift/reduce conflict


From: sobich
Subject: shift/reduce conflict
Date: Mon, 17 Jul 2006 01:32:44 -0700 (PDT)

Hi! I have the grammar that has, among others, these rules:

DECLARLIST ->  DECLARLIST  ; IDENTS :TYPE  
                     | IDENTS :TYPE 

IDENTS ->  IDENTS  ,  id
             |  id

ASSIGNMENT_STMT -> id assignop EXPRESSION;


When I use it on Bison (on Windows platform), it writes I have 1
shift/reduce conflict.
Indeed, in these rows:

vlist i, j : int;
i = 10;
j = 1;

i and j interpreted like they has  been deckared already, i.e. it rises id
redeclaration error (twice, of cource). 

When I run bison with --verbose option it writes me such result:

State 14 contains 1 shift/reduce conflict

state 14

    DECLARATIONS  ->  vlist DECLARLIST .   (rule 8)
    DECLARLIST  ->  DECLARLIST . IDENTS colon TYPE semicolon   (rule 10)
    DECLARLIST  ->  DECLARLIST . semicolon IDENTS error TYPE   (rule 12)

    semicolon   shift, and go to state 20
    id          shift, and go to state 13

    id          [reduce using rule 8 (DECLARATIONS)]
    $default    reduce using rule 8 (DECLARATIONS)

    IDENTS      go to state 21

If somebody has some idea how can I overcome this problem, please answer me.
Thank you in advance,
Alex
-- 
View this message in context: 
http://www.nabble.com/shift-reduce-conflict-tf1953490.html#a5357326
Sent from the Gnu - Bison - Help forum at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]