a+++b parsing according to manual

dgary at ecsvax.UUCP dgary at ecsvax.UUCP
Sat Apr 28 04:19:48 AEST 1984


   The argument over whether a+++b parses as (a++)+b or a+(++b) is solved (at
least I think it's solved, but what do I know?) by reference to section 2 of
the C reference manual in K&R's The C Programming Language.  There we are
clearly told that the parser is to return the longest possible string that
could be a token, so (a++)+b has to be right.
   In addition, some people have claimed that C ignores spaces in its parses.
I think that's due to a misreading of K&R.  It clearly says that spaces are
required (by spaces I mean white space, by the way, including comments) to
separate identifiers that would otherwise be adjacent.  In addition, it asserts
that white space between tokens is syntactically meaningless, but that's
whitespace BETWEEN tokens, not within them.  The expression a+ ++b cannot be
parsed as (a++)+b because the token ++ cannot contain an imbedded blank.
   Or am I misreading this?



More information about the Comp.lang.c mailing list