Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #2144
| Path | csiph.com!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end |
|---|---|
| From | Kaz Kylheku <157-073-9834@kylheku.com> |
| Newsgroups | comp.compilers |
| Subject | Re: Why do some versions of bison require {} here? |
| Date | Wed, 2 Jan 2019 19:29:46 +0000 (UTC) |
| Organization | Aioe.org NNTP Server |
| Lines | 35 |
| Sender | news@iecc.com |
| Approved | comp.compilers@iecc.com |
| Message-ID | <19-01-002@comp.compilers> (permalink) |
| References | <19-01-001@comp.compilers> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| Injection-Info | gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="65176"; mail-complaints-to="abuse@iecc.com" |
| Keywords | yacc, errors, comment |
| Posted-Date | 02 Jan 2019 14:50:55 EST |
| X-submission-address | compilers@iecc.com |
| X-moderator-address | compilers-request@iecc.com |
| X-FAQ-and-archives | http://compilers.iecc.com |
| Xref | csiph.com comp.compilers:2144 |
Show key headers only | View raw
On 2019-01-01, Philipp Klaus Krause <pkk@spth.de> wrote:
> | addressmod
> {
> }
> ;
>
> for their yacc / bison to accept the rule.
> What is happening here? Why is the {} required? Why only on the last
> rule, while the first one is okay?
>
> Philipp
> [Adding the empty action forces bison to reduce the rule rather than just
> shifting and saving state for later. I couldn't guess why that would matter
> in this case. Are there precedence rules? With your change does the grammar compile
> cleanly or does it have conflicts? -John]
What, John? Shouldn't a missing action be equivalent to { $$ = $1 }?
Here, found it in Bison's manual, "3.4.6 Actions":
If you don’t specify an action for a rule, Bison supplies
a default: $$ = $1.
That should imply that there in fact is an action that requires a
reduction. Unless Bison handles this case specially without a reduce
somehow?
--
TXR Programming Lanuage: http://nongnu.org/txr
Music DIY Mailing List: http://www.kylheku.com/diy
ADA MP-1 Mailing List: http://www.kylheku.com/mp1
[Oops, you're quite right. It's been a decade since I revised
flex+bison and the brain cells are tired. Now I'm just baffled
unless there is some syntax error that the extra rule is somehow
fixing. -John]
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Why do some versions of bison require {} here? Philipp Klaus Krause <pkk@spth.de> - 2019-01-01 10:55 +0100
Re: Why do some versions of bison require {} here? Kaz Kylheku <157-073-9834@kylheku.com> - 2019-01-02 19:29 +0000
Re: Why do some versions of bison require {} here? Philipp Klaus Krause <pkk@spth.de> - 2019-01-03 09:15 +0100
Re: Why do some versions of bison require {} here? Kaz Kylheku <157-073-9834@kylheku.com> - 2019-01-04 03:02 +0000
csiph-web