Liste des Groupes | Revenir à cl c |
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes: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?
>
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.
[...]
[...] I'm skeptical that the C grammar is buggy. [...]
It appears that what Bart means by buggy is different from what
you mean. I think what Bart means is that the grammar is not
suitable for being used by a particular parsing algorithm. Of
course that is not what the C standard means to supply, which is
rules of grammar that exactly reflect what syntactic forms are
suitable (syntactically) as C programs, without regard to how
input source is processed. The C standard's rules of grammar
are meant as a declarative specification, not as a procedural
description. Bart's complaint is, I believe, a complaint that
the grammar rules in the C standard do not provide a suitable
procedural description (for the procedural framework he has in
mind). They aren't meant to. Your comment is meant, I believe,
to be about whether the grammar rules in the C standard provide
an accurate declarative specification, which they almost
certainly do, especially as regards to the limited area of
expression syntax.
Les messages affichés proviennent d'usenet.