Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!ucbvax!husc6!rice!titan!preston From: preston@titan.rice.edu (Preston Briggs) Newsgroups: comp.lang.misc Subject: Re: What I'd really like to see in an if-statement... Message-ID: <516@brazos.Rice.edu> Date: 10 Aug 89 18:54:34 GMT References: <8577@batcomputer.tn.cornell.edu> <14251@haddock.ima.isc.com> Sender: root@rice.edu Reply-To: preston@titan.rice.edu (Preston Briggs) Organization: Rice University, Houston Lines: 56 In article <14251@haddock.ima.isc.com> > karl@haddock.ima.isc.com (Karl Heuer) writes: > ... You simply add a new production rule >which parses "a < x < b" as a ternary operator, >and produce code equivalent to > evaluate x into temp > compare a with temp > jump-if-ge FALSE-BRANCH > compare temp with b > jump-if-ge FALSE-BRANCH >Generating the temporary is trivial for a compiler; >it's not as if this had to >be parsed by a macro preprocessor. > >The lookahead to distinguish the constructs "E < E < E" and "E < E" is, I >believe, no worse than the problem of distinguishing "if (E) S;" and >"if (E) S; else S;". But you wouldn't want a single production to get a