[net.sources.bugs] L-values vs. Yacc and Lex for 11/12/84 draft of ANSI C

howard@cyb-eng.UUCP (Howard Johnson) (05/24/85)

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.

jeff@gatech.CSNET (Jeff Lee) (06/04/85)

> 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 deficiency exists in the original grammar as put out by the ANSI
committee, as well as the two put out since then (January and April 30, 1985).
As soon as I see if an item is actually a bug in the grammar I'll post the
April 30, 1985 grammar to the net. See mod.std.c for further information.
Film at 11.
-- 
Jeff Lee
CSNet:	Jeff @ GATech		ARPA:	Jeff%GATech.CSNet @ CSNet-Relay.ARPA
uucp:	...!{akgua,allegra,hplabs,ihnp4,linus,seismo,ulysses}!gatech!jeff