Print

Print


> Date: Tue, 9 Sep 2003 16:19:45 -0400
> From: Ray Denenberg <[log in to unmask]>
>
> > No, just because the grammar specifies that the "and" binds tighter
> > than the prefix mapping.  It's exactly analogous to the way that
> > arithmetic in nearly all programming languages knows that a+b*c means
> > a+(b*c) rather than (a+b)*c -- because "*" binds tighter than "+".
>
> But we don't have operator precedence in cql, it's left-to-right.

Ah contraire.  We _do_ have operator precedence.  For example, all the
relations bind tighter than all the booleans so that
        dc.title=dinosaur and farlow
means
        (dc.title=dinosaur) and farlow
rather than
        dc.title=(dinosaur and farlow)

It is true that all _binary_ operators have the same precendence --
just as "+" and "-" have the same precedence in most programming
languages.  But that's only part of the story.

> (And even if we did, who says "and" takes precedence over a prefix
> assignment. I don't mean to be ornery here, but I don't think this
> is nailed down.)

Who says?  The BNF does!  That's what it's for!

 _/|_    _______________________________________________________________
/o ) \/  Mike Taylor  <[log in to unmask]>  http://www.miketaylor.org.uk
)_v__/\  "You cannot really appreciate Dilbert unless you've read it
         in the original Klingon." -- Klingon Programming Mantra

--
Listen to my wife's new CD of kids' music, _Child's Play_, at
        http://www.pipedreaming.org.uk/childsplay/