C parsing: significance of spaces, and the meaning of "+++"

bet at ecsvax.UUCP bet at ecsvax.UUCP
Tue Apr 24 02:20:02 AEST 1984


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



More information about the Comp.lang.c mailing list