Re: ambiguity in XQuery grammar

Damien Fisher 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 Kay replied:
>
> It is indeed an ambiguity, and I've been concerned about it too, ...

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. So
both of the suggested parsings are illegal, and in fact, the example query
has no legal parse.

-Michael Dyck

Received on Thursday, 6 June 2002 00:14:01 UTC