Re: How is ambiguity defined?

On Wednesday 05 January 2022 17:15:13 (+01:00), Norm Tovey-Walsh wrote:

> > In your case, the serializations being the same is thanks to the "-"
> > before the rules. Take them away, and you see that the parses are
> > truly ambiguous, and it is that that is reported as an error.
>
> Yes, the “-”s were there specifically to make that point. What I believe
> you are saying is that the parses are ambiguious (because they are!)
> even though if you asked the implementation to return all of them, they
> would all look “the same”.
Exactly. 

> I think that makes sense, though it may be a little confusing for users
> at first.

I agree, but unavoidable. I ran against it myself with the ixml grammar, the essence of the problem being:

a: b, c.
b: spaces, "b", spaces.
c: spaces, "c", spaces.
spaces: -" "*.

With input 
b   c
(that's three spaces between b and c) there are 4 different parses, all with identical serializations.

> > is "a00a" ambiguous? Sure it is.
>
> Right. I happened to have an example with matching nothing because of a
> test case I was working on, not because I thought it was special.

Yes, but there is a discussion on the horizon about whether there is only one empty. 

Steven

Received on Wednesday, 5 January 2022 17:22:05 UTC