- From: C. M. Sperberg-McQueen <cmsmcq@blackmesatech.com>
- Date: Mon, 21 Feb 2022 10:30:47 -0700
- To: Steven Pemberton <steven.pemberton@cwi.nl>
- Cc: John Lumley <john@saxonica.com>, Norm Tovey-Walsh <norm@saxonica.com>, public-ixml@w3.org
Steven Pemberton writes:
> ...
> The new syntax would be:
>
>
> -term: factor;
> option;
> repeat0;
> repeat1.
> -factor: terminal;
> nonterminal;
> -"(", s, alts, -")", s.
> repeat0: factor, -"*", s;
> factor, -"**", s, sep;
> repeat1: factor, -"+", s;
> factor, -"++", s, sep.
> option: factor, -"?", s.
> sep: factor.
I think this may work. I have not found an ambiguity, though I'd like
to spend some more time checking more carefully. In particular, I think
the expressions
a*b
a**b
are each unambiguous; the first is a syntax error (missing comma, or
missing star) and the second can only be a repetition-with-separator.
a**
on the other hand is not a syntax error but a nested repetition. It
appears that we have a tradeoff between two possible errors which are
undetectable because they mean something different: Norm's original
error of omitting a comma, leading to s* -'}', and the error of omitting
a separator, leading to a**.
I guess that for me, at least, omitting a comma is likely to be a more
common error than intending to write a separator and failing to do so,
so from that point of view the change looks good. (But as I say I'd
still like to spend some time looking for ambiguities.)
Michael
--
C. M. Sperberg-McQueen
Black Mesa Technologies LLC
http://blackmesatech.com
Received on Monday, 21 February 2022 17:31:11 UTC