Re: an ambiguity in the ixml grammar for ixml grammars

Norm Tovey-Walsh writes:

>> I have not compared our enumerations; my logic is that each of the three
>> substrings 'a.a.a.a' can be parsed like "a. a.a.a" or like "a.a. a.a" or
>> like "a. a.a.a".  Three possibilities for three positions, 3**3 = 27.
>
> I see what you mean. I’ll have to explore that some more.
>
>> But I think not necessarily.
>>
>>     S=a.a.a=c;a,a.a;a.a.a='a'.c='x'.  
>>
>> As far as I can tell, there are four parses for this, two of which are
>> clean:  no undefined nonterminals, no unreachable nonterminals, no
>> unproductive nonterminals, no duplicate definitions.

> Well, that would raise the problem to the level of four alarm fire, I
> think. 

Golly, this is error-prone stuff.  When I write out the two parses I had
in mind for the above, the second rule turns out to be unreachable.  (OK
by the standards of our current spec, since the nonterminal on the
left-hand side is referred to.  But it's not, strictly speaking, an
unproblematic grammar.)

Here's another try.

  S=a.a.a=c;a.a.a=c;.c='x';a;a.a.

And to keep myself honest, two unambiguous grammars that correspond to
the two clean parses:

  S=a.  a.a=c;a.a.  a=c;.  c='x';a;a.a.
  S=a.a.  a=c;a.  a.a=c;.  c='x';a;a.a.

Michael

--
C. M. Sperberg-McQueen
Black Mesa Technologies LLC
http://blackmesatech.com

Received on Saturday, 26 February 2022 21:59:08 UTC