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

RE: ambiguity in XQuery grammar

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Thu, 6 Jun 2002 14:03:52 +0200
Message-ID: <DFF2AC9E3583D511A21F0008C7E6210602679E7E@daemsg02.software-ag.de>
To: Damien Fisher <damien@sodatech.com>, Michael Dyck <michaeldyck@shaw.ca>
Cc: Michael.Kay@softwareag.com, www-ql@w3.org

> > > 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.

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.

Michael Kay
Received on Thursday, 6 June 2002 08:04:00 GMT

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