Sujet : Re: Top 10 most common hard skills listed on resumes...
De : jameskuyper (at) *nospam* alumni.caltech.edu (James Kuyper)
Groupes : comp.lang.cDate : 01. Sep 2024, 18:12:53
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vb27al$1iba7$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : Mozilla Thunderbird
Bart <
bc@freeuk.com> writes:
On 31/08/2024 23:31, Keith Thompson wrote:
Bart <bc@freeuk.com> writes:
...
I can also say that the C grammar is buggy:
>
assignment-expression:
conditional-expression
unary-expression asssignment-operator assignment-expression
>
When attempting to parse an assignment-expression, do you go for a
conditional-expression or unary-expression?
Why are you attempting to parse an assignment-expression?
At the start a new statement, once you've gotten far enough to rule out
any other kind of statement, you should to parse it as an expression
statement (6.8.3), which starts with an expression. If you have already
parsed the statement far enough to recognize a unary expression, and
then find it followed by an assignment operator, then you should check
to see if the rest of the statement is an assignment-expression. If the
first part isn't a unary-expression, then with few exceptions (such as
inside a _Generic() expression), it's a syntax error.
The latter is a subset of the former. If you go for a
conditional-expression and find that an assignment-operator follows,
now you have to perform some analysis on the LHS to see if that
conditional-expression contains only a unary-expression.
It qualifies as a conditional-expression only because being a
unary-expression is one of the ways it can qualify as conditional
expression. You can discard information about having recognized it as a
unary-expression if it's convenient, but you can't argue that it's
convenient to discard it and at the same time complain about the fact
the consequences of having discarded it.