- From: Pankaj Kamthan <kamthan@cs.concordia.ca>
- Date: Wed, 19 Jul 2000 21:31:09 -0400
- To: quintana@lyon.objectif.fr
- CC: www-math@w3.org
Gerald, "The EBNF ... definition of MathML content markups seems to be far more detailed and precise than the DTD. What do you think of this? Is it normal ?" This is good question for a [non-F]AQ. (David Carlisle has already answered this on your posting of the same to MathML/Mozilla newgroup; here are some details.) The reason for having the EBNF for MathML Content Markup is to express constraints that can not be expressed in the DTD. As pointed out in reference 1. below, "DTD and BNF [and thus EBNF] are not equivalent. It is however possible to create an equivalent context-free (BNF) grammar from any XML DTD, where the terminals are start-tags, end-tags, and #PCDATA and the productions correspond to element types and content model positions. The reverse is not possible in general, so XML DTDs are (in a sense) a subset of BNF." So given a DTD, you could convert that into an equivalent set of EBNF productions; the converse may not always be the case. There are reasons for providing both EBNF and the DTD. XML is based on SGML and the idea of providing a DTD comes from this heritage. (One of the major advantages of XML over SGML is that) the XML 1.0 Specification provides a EBNF for (among other objects) markup declarations (that constitute a DTD). EBNF notation is much more expressive than DTD. For example, an XML DTD does not provide information on the XML prolog but the EBNF does. Also, (as outlined in reference 2. below) the presence of EBNF naturally lends itself to a formal notation that is useful in parser, and in general, compiler design. However, using a DTD may be easier than using the information from the EBNF for authoring documents. If you only had the DTD, you could write a syntactically correct (according to the DTD) document. If you also had the associated specification (prose), then you would be able to infer the semantics of the elements and their attributes (among other objects) in the document. Furthermore, if you also had the EBNF, then you would know whether you should have the document correspond to XML 1.0 (or some other version). So the knowledge of EBNF is necessary to author a document that conforms with the XML 1.0 Specification. Hope this helps. Pankaj 1. SGML and XML grammars as context-free or not - By Joe English. http://www.oasis-open.org/cover/english-cfg.html 2. BNF and EBNF: What are they and how do they work? - By Lars Marius Garshol. http://www.stud.ifi.uio.no/~larsga/download/artikler/bnf.html
Received on Wednesday, 19 July 2000 21:32:56 UTC