Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!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: <549@brazos.Rice.edu> Date: 12 Aug 89 16:58:43 GMT References: <8577@batcomputer.tn.cornell.edu> <14251@haddock.ima.isc.com> <516@brazos.Rice.edu> <8606@batcomputer.tn.cornell.edu> <545@brazos.Rice.edu> <561@halley.UUCP> Sender: root@rice.edu Reply-To: preston@titan.rice.edu (Preston Briggs) Organization: Rice University, Houston Lines: 35 In article <561@halley.UUCP> rrt@halley.UUCP (Robert Teisberg) writes: >In article <545@brazos.Rice.edu> preston@titan.rice.edu (Preston Briggs) writes: >>In Pascal, < doesn't associate. You can't write a >True, you usually can't, but associativity (or lack thereof) is not the >reason. In Pascal, the expression parses as: > >(a >where (aboolean, this is a legitimate (though weird) expression. If c is not >boolean, the compiler should complain of a type clash. Wait. Check the BNF or railroad tracks. (Pause while I try to find a reference!) In "Algorithms+Data Structures" (all I can find right away), an Expression is defined: Expression ::= SimpleExpression [relation SimpleExpression] where [x] denotes an optional "x". So, an expression is a SimpleExpression, optional followed by a Relation and another SimpleExpression. There can't be more than one relation. Contrast this with the definition of SimpleExpression: SimpleExpression ::= [`+'|`-'] Term {AddOp Term} where {x} denotes 0 or more x's. Here we see an optional leading + or -, followed by a Term, followed by a sequence of AddOp's and Term's. It's possible that some standard has changed this definition in the past few years; I haven't kept up. Try it on your favorite compiler! Preston