Alan Kent wrote:
>I have tried to take all the comments in hand and write up a page to
>keep track of the current grammar. I am not trying to rewrite the CQL
>page, just define the grammar and tokenization rules.
>
> http://www.mds.rmit.edu.au/~ajk/zing/cql.htm
>
>I have removed some contraversial comments that were not relevant.
>I should not have included them. I have downgraded some other stuff
>to examples or comments (to help make things make sense, rather than
>trying to propose something).
>
>I have also tried to rewrite it as a BNF to get the left/right association
>stuff specified clearly in the BNF, as Adam suggested. Doing so actually
>made me realise that coming up with a grammar to allow
>
> >"http://dc.org/cql" title=joe or >"http://bath.org/cql" title=joe
>
>hard to do if the first scope clause is meant to be in scope for the
>whole query. (I came up with a grammar but it needed more than one
>symbol lookahead, which is bad for tools like YACC.)
>
>
Thank you for putting this up, Alan.
Making an unambiguous grammar that does that is, real hard. FWIW the
YACC grammar I sent last week does it. It has ambuitiies but YACC
resolves them as it should. (Just like the if-then-else conflict in C).
If it's the last grammar you put up, it is unabiguous which is good.
And, yes, it doesn't allow
>p1 b and >p2 c
I can live with that. Especially, since
>p1 b and/a>p2 c
would be ambiguous - and hard to read. To achive this with Alan's
grammar you would have to use
>p1 and/a (>p2 c)
>Basically, need to decide if the scope is higher or lower priority than
>boolean operators. Do people want to allow
>
> >"http://dc.org/cql" title=joe and author=smith
> >"http://dc.org/cql" title=joe or (>"http://bath.org/cql" title=joe)
>
>OR
>
> >"http://dc.org/cql" (title=joe and author=smith)
> >"http://dc.org/cql" title=joe or >"http://bath.org/cql" title=joe
>
>In the first, boolean operators bind more tightly. In the second, scoping
>binds more tightly than boolean operators. I had guessed that the first
>was wanted as people would probably do.
>
>
>Note: I kept making the mistake in my mind that I could write
>
> >dc title=joe
>
>To set the current context to 'dc'. But the grammar and some previous mail
>says you set the default context to a *URI*, not to a prefix. That is,
>the grammar currently is
>
> scope ::= '>' prefix '=' uri
> | '>' uri
>
>
>
This is right.
>Question: Should the grammar be instead
>
> scope ::= '>' prefix '=' uri
> | '>' prefix
>
>
No.
>so you can say things like:
>
> >dc="http://dc.org/cql" >dc (title=joe and author=smith)
>
>(Define the 'dc' URI prefix, then make it the default.) I looked at Adam's
>YACC grammar, but it says 'term = term | term' so I don't know if the single
>term form is a URI or a prefix.
>
>
-- Adam
>Alan
>
>
>
|