Re: bison c-parse.y:1115.19-20: $$ for the midrule at $4 of `structsp' has no declared type

George Neuner <gneuner2@comcast.net>
Fri, 04 Nov 2011 12:56:08 -0400

          From comp.compilers

Related articles
bison c-parse.y:1115.19-20: $$ for the midrule at $4 of `structsp' has alessandro.basili@cern.ch (Alessandro Basili) (2011-10-31)
Re: bison c-parse.y:1115.19-20: $$ for the midrule at $4 of `structsp' haberg-news@telia.com (Hans Aberg) (2011-10-31)
Re: bison c-parse.y:1115.19-20: $$ for the midrule at $4 of `structsp' alessandro.basili@cern.ch (Alessandro Basili) (2011-11-02)
Re: bison c-parse.y:1115.19-20: $$ for the midrule at $4 of `structsp' gneuner2@comcast.net (George Neuner) (2011-11-02)
Re: bison c-parse.y:1115.19-20: $$ for the midrule at $4 of `structsp' gneuner2@comcast.net (George Neuner) (2011-11-04)
Re: bison c-parse.y:1115.19-20: $$ for the midrule at $4 of `structsp' alessandro.basili@cern.ch (Alessandro Basili) (2011-11-06)
Re: bison c-parse.y:1115.19-20: $$ for the midrule at $4 of `structsp' gah@ugcs.caltech.edu (glen herrmannsfeldt) (2011-11-07)
Re: bison c-parse.y:1115.19-20: $$ for the midrule at $4 of `structsp' gneuner2@comcast.net (George Neuner) (2011-11-07)
| List of all articles for this month |
From: George Neuner <gneuner2@comcast.net>
Newsgroups: comp.compilers
Date: Fri, 04 Nov 2011 12:56:08 -0400
Organization: A noiseless patient Spider
References: 11-10-020 11-11-013
Keywords: bison, parse
Posted-Date: 04 Nov 2011 16:05:34 EDT

On Wed, 02 Nov 2011 12:33:46 -0400, George Neuner
<gneuner2@comcast.net> wrote:


Someone commented offline that my rewrite might not work *if* the
mid-rule start_struct call was needed for recursive structure
definitions. I had looked at the code for start_struct before posting
and it looks like it should handle that situation, but it's difficult
to be sure without building the whole compiler.


John had commented that he tried the obvious fix and got more errors,
so I had looked to eliminate the mid-rule clause. But, it turns out
that with bison 2.4.1, either of the versions below will eliminate the
errors.


STRUCT identifier '{'
{ $<ttype>$ = start_struct (RECORD_TYPE, $2); }
component_decl_list '}'
{ $$ = finish_struct ($<ttype>4, $5); }


or
STRUCT identifier '{'
{ $<ttype>3 = start_struct (RECORD_TYPE, $2); }
component_decl_list '}'
{ $$ = finish_struct ($<ttype>3, $5); }


The second version passes the state through the token for the opening
brace in case mid-rule results are somehow broken.


Remember, though, that just because bison is happy does not mean the
generated C code will work.


Hope this ... doesn't confuse the issue more.
George



Post a followup to this message

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