| Deutsch English Français Italiano |
|
<878qslwjj4.fsf@nosuchdomain.example.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: question about linker
Date: Wed, 11 Dec 2024 21:35:27 -0800
Organization: None to speak of
Lines: 51
Message-ID: <878qslwjj4.fsf@nosuchdomain.example.com>
References: <vi54e9$3ie0o$1@dont-email.me> <vid110$16hte$1@dont-email.me>
<vifcll$1q9rj$1@dont-email.me> <vifiib$1s07p$1@dont-email.me>
<87ldwx10gv.fsf@bsb.me.uk> <vimtt4$27vv$1@dont-email.me>
<86ser1kgp5.fsf@linuxsc.com> <vit69t$1qfgg$1@dont-email.me>
<87ldwtzlc0.fsf@nosuchdomain.example.com>
<vitjgg$1tukq$2@dont-email.me> <vj1bss$325uo$1@dont-email.me>
<vj1h4i$335q1$2@dont-email.me> <vj1mhi$34p7h$1@dont-email.me>
<vj1prj$35je4$1@dont-email.me> <vj7dup$he7i$1@dont-email.me>
<slrnvlik4j.ns4.ike@iceland.freeshell.org>
<vjcens$1kcos$1@dont-email.me> <vjcfnc$1kfcq$1@dont-email.me>
<vjcftu$1kk6l$1@dont-email.me> <vjchk5$1kmm9$1@dont-email.me>
<vjdq1p$1vslc$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Thu, 12 Dec 2024 06:35:29 +0100 (CET)
Injection-Info: dont-email.me; posting-host="fce124256618fa8243377af1ae3d31f3";
logging-data="2088155"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+N6rYQ1cmhezLjKjZtU78m"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:SerDBY98r65mdneKjYsOPOyI3lw=
sha1:C3ia9CqX/TN7LBeTszZBZh+K5rA=
Bytes: 3321
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
[...]
> For (yet another) example; my K&R shows a syntax for expressions like
>
> expression := binary
> binary := binary + binary
> binary := binary * binary
That's odd. Is that an exact quotation?
> An actual expression x = 2 + 3 * 4 would be "ambiguous" (without
> precedence rules).
[...]
My copy of K&R 1st edition (1978) has, among other things:
multiplicative-expression:
expression * expression
expression / expression
expression % expression
additive-expression:
expression + expression
expression - expression
That's ambiguous (presumably precedence is defined elsewhere).
The second edition has something similar to what's in the C standard:
multiplicative-expression:
cast-expression
multiplicative-expression * cast-expression
multiplicative-expression / cast-expression
multiplicative-expression % cast-expression
additive-expression:
multiplicative-expression
additive-expression + multiplicative-expression
additive-expression - multiplicative-expression
Which means that the precedence is defined by the grammar -- but
it also means that categories like "multiplicative-expression"
and "additive-expression" are broader than one might naively
expect. For example, 42 is both a multiplicative-expression and
an additive-expression, even though it contains no multiplicative
or additive operators. (Solving both issues would have required
using even more convoluted names for the categories.)
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */