L-values vs. Yacc and Lex for 11/12/84 draft of ANSI C
Howard Johnson
howard at cyb-eng.UUCP
Fri May 24 18:58:42 AEST 1985
There is a deficiency in the Yacc/Lex grammar for the 11/12/84 draft of
ANSI C posted to mod.sources recently. It has to do with the concept of
l-values, namely: statements such as those shown below which are given
to the parser do not generate syntax errors, requiring semantic
interpretation to flag these errors.
main()
{
char *foo;
foo = "hello, world"++;
sizeof(int) = 3;
}
Now I personally would not like to see increment/decrement operators
used legitimately on arbitrary r-values, as this would affect the
semantic meaning of those operators.
The rest of the grammar seems to be all right; there is just one
intentional shift/reduce conflict with the dangling-else construct
of C, and no dependence on %prec declarations. L-values shouldn't
be hard to add to the grammar.
Having the lexical analyzer ignore spurious characters (such as '$')
seems peculiar, but that is another subject.
More information about the Comp.sources.bugs
mailing list