Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!216.196.98.146.MISMATCH!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.iecc.com!nerds-end From: George Neuner Newsgroups: comp.compilers Subject: Re: bison c-parse.y:1115.19-20: $$ for the midrule at $4 of `structsp' has no declared type Date: Fri, 04 Nov 2011 12:56:08 -0400 Organization: A noiseless patient Spider Lines: 34 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <11-11-022@comp.compilers> References: <11-10-020@comp.compilers> <11-11-013@comp.compilers> NNTP-Posting-Host: news.iecc.com X-Trace: leila.iecc.com 1320437134 97634 64.57.183.58 (4 Nov 2011 20:05:34 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Fri, 4 Nov 2011 20:05:34 +0000 (UTC) Keywords: bison, parse Posted-Date: 04 Nov 2011 16:05:34 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: x330-a1.tempe.blueboxinc.net comp.compilers:324 On Wed, 02 Nov 2011 12:33:46 -0400, George Neuner 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 '{' { $$ = start_struct (RECORD_TYPE, $2); } component_decl_list '}' { $$ = finish_struct ($4, $5); } or STRUCT identifier '{' { $3 = start_struct (RECORD_TYPE, $2); } component_decl_list '}' { $$ = finish_struct ($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