Re: if then else shift/reduce Syndrome

solution@gate.net (Ken Walter)
13 Feb 1996 18:07:04 -0500

          From comp.compilers

Related articles
if then else shift/reduce Syndrome tarnwb@holly.colostate.edu (Tarn Burton) (1996-02-13)
Re: if then else shift/reduce Syndrome solution@gate.net (1996-02-13)
Re: if then else shift/reduce Syndrome tim@franck.Princeton.EDU (1996-02-13)
Re: if then else shift/reduce Syndrome mab@wdl.loral.com (1996-02-14)
Re: if then else shift/reduce Syndrome theo@engr.mun.ca (1996-02-16)
Re: if then else shift/reduce Syndrome meissner@cygnus.com (Michael Meissner) (1996-02-16)
Re: if then else shift/reduce Syndrome solution@gate.net (1996-02-16)
Re: if then else shift/reduce Syndrome tarnwb@holly.colostate.edu (Tarn Burton) (1996-02-16)
[5 later articles]
| List of all articles for this month |

From: solution@gate.net (Ken Walter)
Newsgroups: comp.compilers
Date: 13 Feb 1996 18:07:04 -0500
Organization: Solution Technology
References: 96-02-123
Keywords: yacc, syntax

Tarn Burton <tarnwb@holly.colostate.edu writes:
>Does anyone know how to get rid of the bison shift/reduce conflict in
>the C if then else.


Yes, classify statements as open or closed.
if-else is a closed statement and if without the else is an open statement.
Anything with a potential matching clause is open.
Thats why Algol68's if-fi do-od etc. was so nice, everything was closed.


open-if : if-query open-statement
| if-query closed-statement else open-statement
closed-if : if-query closed-statement else closed-statement


statement : open-statement
| closed-statement


closed-statement : closed-if
| assignment-statement
| ...


Ken Walter
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.