“Consensus” grammar(s)

Hi folks,

I was hoping we’d get closure on the consensus proposals before the
weekend, but that didn’t happen. I think there is support for

* Changing ~ to !
* Using = and | exclusively
* A version declaration
* Using + for insertions

No objections have been made, and each proposal has received at least a
few nods of support.

I wondered what that might look like, so I wrote up a grammar for it. It
looks a bit different on the surface, because the delimiters have
changed, but is otherwise very similar.

I was pleased that it was easy to make the prolog entirely optional. If
you don’t specify a version declaration, the XML serialization of an
ixml grammar is unchanged.

For fun, I also extended it to include the namespaces proposal. Again,
the prolog is entirely optional. If you don’t declare a version or any
namespaces, the XML serialization of a grammar is unchanged from before.
If you don’t want or care about namespaces, you can just completely
ignore them.

Namespace support only adds a few new nonterminals. I made some
aesthetic choices that we could quibble over. A grammar with a version
and namespaces under my example grammar looks like this:

  ixml version "1.0" .
  default namespace = "http://docbook.org/ns/docbook" .
  namespace mml = "http://www.w3.org/1998/Math/MathML" .

  mml:foo = 'foo' .

and serializes like this:

  <ixml>
     <prolog>
        <version>1.0</version>
        <namespace uri="http://docbook.org/ns/docbook"/>
        <namespace prefix="mml" uri="http://www.w3.org/1998/Math/MathML"/>
     </prolog>
     <rule name="mml:foo">
        <alt>
           <literal string="foo"/>
        </alt>
     </rule>
  </ixml>

I didn’t try to make it syntactically impossible to specify more than
one default namespace. I think that’s easier handled as a semantic
constraint, like the actual prefixes used in nonterminals.

(If you want to play with the grammars with NineML, you’ll have to “back
out” the change from “~” to “!” since the NineML parser expects “~”.)
                                        Be seeing you,
                                          norm

--
Norm Tovey-Walsh
Saxonica

Received on Saturday, 23 April 2022 14:46:10 UTC