Advertisement

03.30.2008 at 11:51AM PDT, ID: 23280991
[x]
Attachment Details

how to solve yacc if else shift/reduce problem

Asked by fabytes in Parsers, C Programming Language

Tags: bison yacc

Hi, I have a rule defined as follow:

  comando :  IF '(' exp ')' comando parte_else
                    | WHILE '(' exp ')' comando
                    | FOR '(' exp '=' exp ';' exp ';' exp ')' comando
                    ;

    parte_else : ELSE comando
                      | /* empty */
               ;

It's a more then famous shift/reduce problem, but the weird thing is that in my output is says the reduce is the default action, when I want to shift. I was told that bison would make shift default. How do I fix it?

grammar.output:

state 213

   63 comando: IF '(' exp ')' comando .
   64        | IF '(' exp ')' comando . ELSE comando

    ELSE  shift, and go to state 216

    ELSE      [reduce using rule 63 (comando)]
    $default  reduce using rule 63 (comando)Start Free Trial
[+][-]03.31.2008 at 02:11AM PDT, ID: 21244036

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 06:38AM PDT, ID: 21245202

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 06:54AM PDT, ID: 21245348

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 07:05AM PDT, ID: 21245446

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 07:08AM PDT, ID: 21245473

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 07:25AM PDT, ID: 21245621

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 07:45AM PDT, ID: 21245800

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 08:14AM PDT, ID: 21246116

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Parsers, C Programming Language
Tags: bison yacc
Sign Up Now!
Solution Provided By: Infinity08
Participating Experts: 1
Solution Grade: A
 
 
[+][-]03.31.2008 at 08:25AM PDT, ID: 21246235

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 08:28AM PDT, ID: 21246268

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.31.2008 at 08:36AM PDT, ID: 21246343

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628