- From: C. M. Sperberg-McQueen <cmsmcq@blackmesatech.com>
- Date: Thu, 16 Dec 2021 08:00:34 -0700
- To: Norm Tovey-Walsh <norm@saxonica.com>
- Cc: "C. M. Sperberg-McQueen" <cmsmcq@blackmesatech.com>, ixml <public-ixml@w3.org>
The rewrite you describe makes the ’sep’ element contain multiple children instead of one. Since under the current rules a ’sep’ always contains exactly one factor, the rewrite seems to produce a simpler tree at the expense of a more complicated semantics (because now we will need more complicated rules for ’sep’, since it has more variation in its content). Whether it’s safe depends, I think, on whether the operational semantics your code is assigning to elements cover cases which do not arise under the spec as now written. On a purely practical level, in ixml it’s easier to make hiding or serializing any nonterminal depend on the context than to make it depend on the content. Michael > On 16,Dec2021, at 6:08 AM, Norm Tovey-Walsh <norm@saxonica.com> wrote: > > Hello, > > As I was looking at rewriting to ease implementation, I happened to > notice that the ixml grammar for ixml contains a few places where an > “alts” contains a single “alt”. > > Is it safe to simplify that construction? For example, consider: > > <rule name='alt'> > <alt> > <repeat0> > <nonterminal name='term'/> > <sep> > <alts> > <alt> > <literal tmark='-' dstring=','/> > <nonterminal name='s'/> > </alt> > </alts> > </sep> > </repeat0> > </alt> > </rule> > > It feels like that should be the same as: > > <rule name='alt'> > <alt> > <repeat0> > <nonterminal name='term'/> > <sep> > <literal tmark='-' dstring=','/> > <nonterminal name='s'/> > </sep> > </repeat0> > </alt> > </rule> > > But I’ve been unable to prove that to myself in the general case. Is it > ever wrong to remove an “alts” that contains a single alternative? > > Be seeing you, > norm > > -- > Norm Tovey-Walsh > Saxonica
Received on Thursday, 16 December 2021 15:00:54 UTC