What does "a---b" mean?
Chris Torek
chris at mimsy.umd.edu
Wed Jan 3 19:30:28 AEST 1990
In article <1303 at mit-amt.MEDIA.MIT.EDU> adamk at mit-amt.MEDIA.MIT.EDU
(Adam Kao) writes:
>To summarize, my understanding is:
>
>1. The lexical analyzer scans left to right making the biggest token
> possible.
Yes.
>2. Compound assignment tokens (ONLY) can be read as two consecutive
> tokens (ie separated by whitespace ONLY) that are IMMEDIATELY
> joined into one token.
Yes, but only in Classic C, not in New C (proposed ANSI standard C).
>3. Remaining ambiguity is resolved by simple (hah!) precedence and
> associativity rules.
More or less. C has no nonassociative operators, so every syntactically
correct expression has a defined grouping. The result can still be
ambiguous in another sense, e.g.,
p += *p++;
is easy to parse but hard to describe.
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris at cs.umd.edu Path: uunet!mimsy!chris
More information about the Comp.lang.c
mailing list