[net.lang.c] C parsing: significance of spaces, and the meaning of "+++"

bet@ecsvax.UUCP (04/23/84)

Thinking about the recent question "Why does our compiler gag on a program
containing *a/*b but not (*a)/(*b) [the first one starts a comment] brought
to mind the question "Are spaces significant in disambiguating parsing?" In an
effort to come up with a clear example of an ambiguous parse, I came up with
the expression "a+++b". Is that "(a++)+b" or "a+(++b)"? Gazing at The Book,
page 49 (precedence of operators) I note that "++" has higher precedence than
"+", and associates right-to-left. Does that demand the second parse (a+(++b))?
This is beyond me. Unary operators are the cause of it all.

					Bennett Todd
					...{decvax,ihnp4,akgua}!mcnc!ecsvax!bet

eric@gang.UUCP (Eric Kiebler) (04/28/84)

+++ is a special *FEATURE* of C that turns off a Hayes modem... :-)

eric
-- 
from the gang down at...  38.37.45 N   90.12.22 W
	..!ihnp4!afinitc!{gang|wucs!gang}!eric

Any sufficiently advanced technology is indistinguishable from a rigged demo.
Copyright (C) 1984 All Rights Reserved.

dave@qtlon.UUCP (05/05/84)

Although I agree that /* versus / * is a niggly problem, it is NOT
an ambiguity in the reference manual, which states (fairly early on)
that if the program has been parsed up to a certain point, then the
next token is considered to be the longest possible sequence which
could be a token.

(This also covers the +++ problem as well.)

			*++*argv rules OK,
				Dave Lukes (<U.K.>!ukc!qtlon!dave)