help-bison
[Top][All Lists]
Advanced

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

Re: help with an if rule!


From: Roberto Mandall
Subject: Re: help with an if rule!
Date: Sun, 14 Aug 2005 21:43:19 +0200
User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)

thx for the answer,but i still get errors, i guess i just do not undertsnad bison well enough.
i have this now:
%nonassoc ELSE
%nonassoc THEN

open_if_statement : IF boolean_expression {} THEN  statement {/}
|IF boolean_expression {} THEN closed_statement ELSE open_statement{} ; closed_if_statement : IF boolean_expression {} THEN closed_statement ELSE closed_statement {};


i get this:
bison -d --debug -v parser.y
parser.y: conflicts: 1 reduce/reduce

parser out put says:
State 140 conflicts: 1 reduce/reduce

state 140 has got this:

state 140

  38 statement: closed_statement .
54 open_if_statement: IF boolean_expression THEN closed_statement . @13 ELSE open_statement 56 closed_if_statement: IF boolean_expression THEN closed_statement . @14 ELSE closed_statement

   ELSE      reduce using rule 53 (@13)
   ELSE      [reduce using rule 55 (@14)]
   $default  reduce using rule 38 (statement)

   @13  go to state 162
   @14  go to state 163

can any1 plz tell me what am i doing wrong? i do really need those semantic rules after the "THEN closed_statement"

Hans Aberg escribió:


On 14 Aug 2005, at 18:53, Roberto Mandall wrote:

open_if_statement : IF boolean_expression THEN  statement
|IF boolean_expression THEN closed_statement ELSE open_statement;

closed_if_statement : IF boolean_expression THEN closed_statement ELSE closed_statement;

i want to add some semantic actions after the then ,but i get conflicts,


You can use token precedences (like %nonassoc) on "ELSE" and "THEN".

  Hans Aberg




                
______________________________________________ Renovamos el Correo Yahoo! Nuevos servicios, más seguridad http://correo.yahoo.es





reply via email to

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