ambiguous why?
Eddie Wyatt
edw at IUS1.CS.CMU.EDU
Wed Apr 6 03:02:24 AEST 1988
> > *a+=*b;
> >
>
> K&R A.17 talks about earlier versions of C which used the form "=op"
> instead of "op=". Most(?) compilers still try to detect the old form
> and issue a warning. In my opinion this causes headaches more than it
> catches obsolete code. Anyway, the compiler wasn't sure if you wanted
> "addition assignment" (+=) or the old multiplication assignment (=*) so
> it complained. Putting a space after the "=" fixes it:
This doesn't answer my question. I am familiar with the old
syntax for operand assignment. I understand that without some sort of
lexer rule, the above is ambiguous. However, I thought that a
rule existed that should disambiguated this statement. In particular,
I do believe a rule exist such that you choose the largest token
posible as you scan left to right. That is why the statement a+++b is
not ambiguous (optional read a++ + b).
If what you wrote about the tokenization of += (two separate tokens + =)
is correct then the above statement is ambiguous at the parsing level.
In which case I could understand there not existing a disambiguating rule.
--
Eddie Wyatt e-mail: edw at ius1.cs.cmu.edu
More information about the Comp.lang.c
mailing list