W3C home > Mailing lists > Public > www-ql@w3.org > April to June 2002

Re: ambiguity in XQuery grammar

From: Michael Dyck <michaeldyck@shaw.ca>
Date: Thu, 06 Jun 2002 20:02:18 -0700
To: "Kay, Michael" <Michael.Kay@softwareag.com>
Cc: Damien Fisher <damien@sodatech.com>, www-ql@w3.org
Message-id: <3D00223A.FB58BD29@shaw.ca>

"Kay, Michael" wrote:
> 
> > > > There appears to be an ambiguity in the current draft
> > > > specification's grammar, which I was hoping someone could resolve
> > > > for me.
> > > >
> > > > Consider:
> > > >     1 instance of xs:integer+ +1
> > > > Is this equivalent to:
> > > >     (1 instance of xs:integer+) +1
> > > > or:
> > > >     (1 instance of xs:integer) + (+1)
> > > > ?
> > >
> Michael Dyck said...
> > >
> > > I don't think it is an ambiguity.
> > >
> > > According to A.3 Precedence Order, InstanceofExpr is at precedence
> > > level 6 and AdditiveExpr is at level 8. Now, while the exact
> > > grammatical meaning of
> > > the precedence table has never been given, my
> > interpretation is that
> > > an AdditiveExpr cannot have an InstanceofExpr as either of its
> > > operands.
> 
> Yes, I think that's correct: the precedence can be used to disambiguate this
> case. However, that's still a little unsatisfactory. Firstly because, as was
> pointed out, the meaning of the precedence table is rather fuzzily defined,
> and secondly, because even if it's unambiguous, you still need to apply some
> special reasoning to decide that the "+" is part of the "instance of"
> expression. In my parser, this consists simply of saying that if you find
> "+", "*", or "?" at this point, then it's part of the SequenceType.

If you think my interpretation of the precedence table is correct, then I
think you'll find that the query in question is illegal. Thus, this isn't
a case of disambiguation. Nor do you need special reasoning to decide
that the first "+" belongs to the InstanceofExpr (or not): the query is
illegal whichever way you decide.

> We're working on a revised way of presenting the grammar, this has been
> somewhat delayed but hopefully will bring improvements in the next draft.

Ah good.

-Michael Dyck
Received on Thursday, 6 June 2002 23:04:52 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 22 July 2006 00:10:18 GMT