Re: Dangling else
- From: "Dmitry A. Kazakov" <mailbox@xxxxxxxxxxxxxxxxx>
- Date: 6 Mar 2006 02:11:45 -0500
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
.
- References:
- Re: Dangling else
- From: Dave Thompson
- Re: Dangling else
- Prev by Date: Re: Dynamic Evaluation & Precompiled Bytecode
- Next by Date: Re: Time complexity of LR parser generation
- Previous by thread: Re: Dangling else
- Next by thread: Re: Dangling else
- Index(es):