Other 'significant' blanks

Richard Draves draves at harvard.ARPA
Fri Dec 14 16:39:13 AEST 1984


> > Should a compiler allow blanks between the 'op' and the '=' in an
> > 'op=' operation? ...
> 
> K&R actually says explicitly that (e.g.) "+=" is two tokens; hence
> space between them is allowable (section 7.14).  However, practically
> no C compilers other than the original Ritchie compiler have done it
> this way.  One reason for this is that it makes the language non-LALR(1),
> so all the yacc-based parsers croak.  The current ANSI C draft (12 Nov)
> says that "+=" is one token.
> -- 
> 				Henry Spencer @ U of Toronto Zoology
> 				{allegra,ihnp4,linus,decvax}!utzoo!henry

Why not have the lexxer recognize the double tokens?  For instance,
one rule for lex might be "+"[ \t\n]*"=", etc.

Rich



More information about the Comp.lang.c mailing list