Re: Dangling else

"Dmitry A. Kazakov" <>
6 Mar 2006 02:11:45 -0500

          From comp.compilers

Related articles
[4 earlier articles]
Re: Dangling else (Russ Cox) (2006-02-24)
Re: Dangling else (SM Ryan) (2006-03-05)
Re: Dangling else (SM Ryan) (2006-03-05)
Re: Dangling else (=?ISO-8859-1?Q?Jan_Vorbr=FCggen?=) (2006-03-05)
Re: Dangling else (2006-03-05)
Re: Dangling else (Dave Thompson) (2006-03-05)
Re: Dangling else (Dmitry A. Kazakov) (2006-03-06)
Re: Dangling else (Russ Cox) (2006-03-06)
Re: Dangling else (Marco van de Voort) (2006-03-11)
Re: Dangling else (Brian Inglis) (2006-03-11)
Re: Dangling else (2006-03-14)
Re: Dangling else (Karsten Nyblad) (2006-03-15)
Re: Dangling else (Hans-Peter Diettrich) (2006-03-15)
[2 later articles]
| List of all articles for this month |

From: "Dmitry A. Kazakov" <>
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
Posted-Date: 06 Mar 2006 02:11:45 EST

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. (:-)) ]
Dmitry A. Kazakov

Post a followup to this message

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