On 12.12.2024 06:35, Keith Thompson wrote:
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?
No, not exact, I abbreviated it; omitted about 25 other operators and
used another syntax (no ' | '). (Trust me that it hasn't things that
I called 'factor' and 'term' in my post, which is equivalent to what
you have formulated below in your copy.) - I'm using a translation of something that someone classified as being a "pre-second" edition but
not quite the first edition. Two references point to 1977 (Prentice
Hall) and 1978 (Bell Labs). - The text for the "binary" syntax has two optional informal columns, the first one has the comment "precedence"
for some of the variants of "binary" operators. (But it's also just
titled as "Syntax in Short"; probably presented in a form to make it
easy to understand without overloading it for purpose of a textbook.)
It serves the purpose to explain an ambiguous syntax with non-codified precedence and a separate precedence table (but it's not an exact "C"
syntax description as you'd probably find it in standards documents).
On 12/12/24 06:38, Janis Papanagnou wrote:
[...]
My copy of K&R 1st edition has nothing remotely resembling that.
[...]
On 18.12.2024 22:04, James Kuyper wrote:
On 12/12/24 06:38, Janis Papanagnou wrote:
[...]
My copy of K&R 1st edition has nothing remotely resembling that.
I think someone here already mentioned that the English version
looks different compared to the translation I've in my bookshelf.
(So I am not sure what your post is actually intending.[*])> (But that's anyway unimportant to the point I made; that you can
define semantical information like the precedence separately or
by syntax.[**])
Janis
PS: FYI; Some of your posts, James, arrive also in my mailbox.
[*] I've put (if you're interested) a scan of that page uploaded
here: http://volatile.gridbug.de/KR_syntax-rotated90.pdf
(But similar syntaxes for expressions can be found also in other
programming languages' contexts; see below.)
On 12/12/24 06:38, Janis Papanagnou wrote:
On 12.12.2024 06:35, Keith Thompson wrote:
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?
No, not exact, I abbreviated it; omitted about 25 other operators and
used another syntax (no ' | '). (Trust me that it hasn't things that
I called 'factor' and 'term' in my post, which is equivalent to what
you have formulated below in your copy.) - I'm using a translation of
something that someone classified as being a "pre-second" edition but
not quite the first edition. Two references point to 1977 (Prentice
Hall) and 1978 (Bell Labs). - The text for the "binary" syntax has two
optional informal columns, the first one has the comment "precedence"
for some of the variants of "binary" operators. (But it's also just
titled as "Syntax in Short"; probably presented in a form to make it
easy to understand without overloading it for purpose of a textbook.)
It serves the purpose to explain an ambiguous syntax with non-codified
precedence and a separate precedence table (but it's not an exact "C"
syntax description as you'd probably find it in standards documents).
My copy of K&R 1st edition has nothing remotely resembling that. I
cannot find "binary" as an element of the grammar anywhere. There are 16 grammar rules for "expression". The one that comes closest is
"expression binop expression", where binop is one of C's 19 binary
operators, divided into 12 different priority levels.
On Wed, 11 Dec 2024 21:19:54 +0000
bart <bc@freeuk.com> wrote:
This also comes up with 'while (cond); {...}'.
$ cat foo.c
void foo(int x)
{
while (x--);
bar();
}
$ clang-format < foo.c
void foo(int x) {
while (x--)
;
bar();
}
Do I use clamg-format myself? No, I don't.
And I don't know why C formatters are generally less popular among C programmers then, for example, go formater among Go programmers or Rust formatter among Rust programmers.
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
If someone wanted to ensure that all static functions defined in a
translation unit are declared near the top, there could be a separate
tool to generate, or at least check, the declarations. I'm not aware of >>> any such tool, which suggests there probably isn't much demand for it.
What it suggests to me is that there are tools being used that
you aren't aware of.
What that suggests to me is that you feel the need to snipe without
sharing any actual information.
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,007 |
Nodes: | 10 (0 / 10) |
Uptime: | 196:48:46 |
Calls: | 13,143 |
Files: | 186,574 |
D/L today: |
511 files (113M bytes) |
Messages: | 3,310,136 |