Alan Kent wrote:
>On Sat, Nov 29, 2003 at 06:12:44PM +0000, Robert Sanderson wrote:
>>>>a and/mod.ifier > fish b
>>>>Is '> fish' a prefix assignment (that 'fish' is the default context Set
>>>>URI) or is it part of the mod.ifier modifier group?
>>>Very good point. With Alan's grammar it is definitely a modifier, since,
>>>with his grammar, a prefix must be paranthesed as in:
>>>a and/mod.ifier (> fish b)
>>Only in this case, right? Rather than prefixes requiring parens
>Its only to resolve precedence problems.
>'>fish' has to either
>(1) bind more tightly than the boolean connectors (and,or,not,prox)
>(2) bind less tightly than the boolean connectors
>(3) be left/right associative like boolean connectors.
>The latest grammar I put up did (2). If you want to allow
> >dc title=blah or >bath title=blah
>meaning its left to right associative (the same as...
> >dc (title=blah or (>bath (title=blah)))
>then you can do it in the grammar I think by saying
> cqlQuery = ">" [ prefix "=" ] uri cqlQuery
> | searchClause boolean cqlQuery
This won't work because the second line makes booleans right
associative. I strongly suggest we do not go that way.
The only grammar I can come up with that both makes '>' a real prefix
operator while at the same time keep retain left associativity for
booleans is this (this will be a repitiion of the YACC grammar).
// booleans have lowest precedence, left assoc.
cqlQuery ::= searchClause | cqlQuery boolean searchClause
// the highest precedence. But '>' (like grouping) makes a "sub query"
thus overriding precedence!
searchClause ::= '(' cqlQuery ')'
| index relation searchClause
| '>' term [ '=' term ] cqlQuery
In order to go for rule 1, you'd substitute cqlQuery with searchClause
in last rule.
>The negative is that the query looks like the first >dc is applicable
>only to the first title=blah when it really is in scope for the whole
>query. But I find left/right associativity of boolean operators confusing
>anywa, so the above might be more consistent and support the extra query