- From: Norm Tovey-Walsh <norm@saxonica.com>
- Date: Sat, 26 Feb 2022 13:08:23 +0000
- To: "C. M. Sperberg-McQueen" <cmsmcq@blackmesatech.com>
- Cc: public-ixml@w3.org
- Message-ID: <87czj9g3sc.fsf@saxonica.com>
> Consider the following string.
>
> (1) S=a.a.a.a=a.a.a.a.=a.a.a.a='a'.
>
> If I have done my sums correctly, there are 27 ways to parse this string
> in accord with our current grammar for ixml grammars.
My parser says only seven. (Attached below.)
> this string as a conforming ixml grammar. I will only claim that this
> string exhibits an ambiguity in our grammar.
Ayup.
$ coffeepot -g:/tmp/out.ixml a
T: Loading grammar: file:/tmp/out.ixml
I: Parse succeeded, 31 tokens at 620.00 tokens/sec
W: Unreachable symbol: a
W: Unreachable symbol: a.
W: Unreachable symbol: a.a
W: Undefined symbol: a.a.a
W: Unproductive symbol: $$
W: Unproductive symbol: S
W: Unproductive symbol: a
W: Unproductive rule: $$ ⇒ S
W: Unproductive rule: S ⇒ a.a.a
W: Unproductive rule: a ⇒ a.a.a
T: Input: a
There is no rule for the nonterminal symbol ‘a.a.a’.
> I also seem to remember discussing with Bethan last month the
> possibility of ambiguity relating to allowing colons in names, and it
> appears from a review of the mail that we did not notice the existing
> ambiguity.
I certainly hadn’t noticed.
> My first reaction is to think that this is a major problem (a four-alarm
> fire, as some say) that needs attention as soon as possible. Do others
> agree, or am I over-reacting?
It’s definitely ugly. In practice, you can remedy the problems by
putting a space in front of the periods that you are using for
punctuation. A name can’t have a space, so that definitively resolves
the ambiguity.
On that basis, I think we could technically live with it. (Am I right in
my intuition that this kind of ambiguity always involves some unhygenic
symbols or rules?)
However, if we can find consensus to fix this, I would strongly prefer
that.
Off the top of my head, we could remove “.” from the name characters,
we could use a different symbol for “end of rule”, or we could require
whitespace before the rule-ending “.”.
Be seeing you,
norm
-- Norm Tovey-Walsh Saxonica
Attachments
- application/xml attachment: out.xml
Received on Saturday, 26 February 2022 13:24:07 UTC