Sujet : Re: Top 10 most common hard skills listed on resumes...
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.cDate : 09. Sep 2024, 18:29:56
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240909100944.715@kylheku.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2024-09-08, Janis Papanagnou <janis_papanagnou+
ng@hotmail.com> wrote:
On 08.09.2024 16:12, James Kuyper wrote:
On 9/8/24 00:39, Janis Papanagnou wrote:
...
That's why I immediately see the necessity that compiler creators need
to know them in detail to _implement_ "C". And that's why I cannot see
how the statement of the C-standard's "most important purpose" would
sound reasonable (to me). ...
I agree - the most important purpose is for implementors, not developers.
... I mean, what will a programmer get from the
"C" standard that a well written text book doesn't provide?
What the C standard says is more precise and more complete than what
most textbooks say.
>
Exactly. And this precision is what makes standard often difficult
to read (for programming purposes for "ordinary" folks).
The C grammar is not presented in a nice way in ISO C.
It uses nonsensical categories. For instance a basic expression like A
is considered a unary-expression. A newcomer looking at the
grammar for assignment will be wondering how on Earth the A
in A = B is a unary expression, when it contains no unary operator.
The unary-expression is not given in the immediately preceding section,
and no section references are given; you have to go searching through
the document to find it.
I also suspect programmers not versed in parsing and grammars will not
intuit that assignment associates right to left. Someone who remembers
their compiler course from university will know that the right hand side
"unary-expression assignment-operator assignment-expression"
has the assignment-expression on the right, and is therefore
identified as right-recursive, and that leads to right association.
I strongly suspect that the vast majority of the C coders on the planet
(as well as users of other languages that have operator grammars) refer
to operator precedence tables that fit on one page, rather than flipping
around in a telescopic grammar that goes on for pages.
The standard for a language which has operators with precedence
should give a precedence table. The grammar for assignment should
be given as <expr> = <expr>, where you refer to the table if you
want to know how a = b = c or a + b = c are parsed. That would be the
most understandable presentation, or at least the most widely used one
which programmer are used to from books and tutorials.
Books and tutorials about C could just carefully copy and paste the
table from the standard, and be confident that they have the correct
info which matches how the language is defined.
Lastly, the grammar presentation in ISO C is not actually agnostic of
parsing technology. It users left recursion which isn't LL(1) and
therefore presents a challenge to someone writing a recursive-descent
parser, who must factor the grammar.
For a grammar specification to be directly usable to the widest scope of
implementation techniques---if that were a goal---it would have to
be left-factored, where necessary, to meet that goal.
-- TXR Programming Language: http://nongnu.org/txrCygnal: Cygwin Native Application Library: http://kylheku.com/cygnalMastodon: @Kazinator@mstdn.ca