Re: Dangling else

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
6 Mar 2006 02:11:45 -0500

          From comp.compilers

Related articles
[4 earlier articles]
Re: Dangling else rsc@swtch.com (Russ Cox) (2006-02-24)
Re: Dangling else wyrmwif@tsoft.org (SM Ryan) (2006-03-05)
Re: Dangling else wyrmwif@tsoft.org (SM Ryan) (2006-03-05)
Re: Dangling else jvorbrueggen-not@mediasec.de (=?ISO-8859-1?Q?Jan_Vorbr=FCggen?=) (2006-03-05)
Re: Dangling else henry@spsystems.net (2006-03-05)
Re: Dangling else david.thompson1@worldnet.att.net (Dave Thompson) (2006-03-05)
Re: Dangling else mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2006-03-06)
Re: Dangling else rsc@swtch.com (Russ Cox) (2006-03-06)
Re: Dangling else marcov@stack.nl (Marco van de Voort) (2006-03-11)
Re: Dangling else Brian.Inglis@SystematicSW.ab.ca (Brian Inglis) (2006-03-11)
Re: Dangling else henry@spsystems.net (2006-03-14)
Re: Dangling else 148f3wg02@sneakemail.com (Karsten Nyblad) (2006-03-15)
Re: Dangling else DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2006-03-15)
[2 later articles]
| List of all articles for this month |

From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Newsgroups: comp.compilers
Date: 6 Mar 2006 02:11:45 -0500
Organization: cbb software GmbH
References: 06-02-154 06-02-168 06-03-011
Keywords: syntax

On 5 Mar 2006 02:18:54 -0500, Dave Thompson wrote:


> But that's not the problem -- they have to always be adjacent levels,
> hence in one place if you organize the grammar by NT, or you don't
> have (fully-ordered) precedence. In fact C has two places that aren't
> expressible as precedence:
> - (int) x is - ( (int) x ) but (int) -x is (int) (- x)


They could be if we'd drop full order, which is worth of little in
presence of left-to-right and right-to-left rules. The concept of
precedence can be extended to incorporate association direction. The
idea is to split single association priority into left and right
ones. So operations associated from right to left (like unary
operations) would have right priority lower than the left
one. Operations like assignment will have high left and low right
priority. So that A+B:=C+D would be A+(B:=(C+D)).


[ In extreme cases this also allows changing evaluation the order of
unary operations. If somebody wanted that thing. (:-)) ]
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


Post a followup to this message

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