Path: utzoo!mnetor!uunet!husc6!bbn!rochester!PT.CS.CMU.EDU!IUS1.CS.CMU.EDU!edw From: edw@IUS1.CS.CMU.EDU (Eddie Wyatt) Newsgroups: comp.lang.c Subject: Re: ambiguous why? Message-ID: <1320@PT.CS.CMU.EDU> Date: 5 Apr 88 17:02:24 GMT References: <1303@PT.CS.CMU.EDU> <22997@bbn.COM> Sender: netnews@PT.CS.CMU.EDU Organization: Carnegie-Mellon University, CS/RI Lines: 26 > > *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@ius1.cs.cmu.edu