[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: EBNF
Hi, Can the EBNF module be augmented in the following way: - define a <terminal> tag - allow <productionset> in <example> and <informalexample>, and <terminal> and <nonterminal> in free text (for descriptive and didactive purposes) - allow <emphasis> in <lhs> and <rhs> (for descriptive and didactive purposes) - allow <subscript> in <rhs> - use <literal> for the obvious purpose in EBNF grammars (or define a new tag for it, if this usage conflicts with its current definition) See http://www.montefiore.ulg.ac.be/~piater/Cours/INFO0055/Notes/05/foil19.xhtml for a rendered example. I have a home-brew variant of the official EBNF module that implements these ideas, and I think that all of them are of general interest. I'm appending it below. Thanks for your consideration, Justus <!-- Mon Oct 13 16:03:37 2003 Justus H. Piater --> <!-- Derived from: --> <!-- ...................................................................... --> <!-- DocBook EBNF Module V1.1CR1 .......................................... --> <!-- File dbebnf.dtd ...................................................... --> <!-- Copyright (C) 2001, 2002 Organization for the Advancement of Structured Information Standards (OASIS). CVS version string: dbebnf.dtd,v 1.3 2002/09/13 11:53:50 nwalsh Exp Permission to use, copy, modify and distribute the DocBook EBNF Module and its accompanying documentation for any purpose and without fee is hereby granted in perpetuity, provided that the above copyright notice and this paragraph appear in all copies. The copyright holders make no representation about the suitability of the DTD for any purpose. It is provided "as is" without expressed or implied warranty. If you modify the DocBook EBNF Module in any way, label your DTD as a variant of DocBook. See the maintenance documentation for more information. Please direct all questions, bug reports, or suggestions for changes to the docbook@lists.oasis-open.org mailing list. For more information, see http://www.oasis-open.org/docbook/. --> <!-- ...................................................................... --> <!-- Please use the following formal public identifier to identify it: "-//Justus Piater//DTD DocBook EBNF Module V0.1//EN" "http://www.montefiore.ulg.ac.be/~piater/XML/ebnf/0.1/jpebnf.dtd" --> <!-- Justus: allow productionset in example and informalexample --> <!ENTITY % local.example.mix "|productionset"> <!-- Justus: allow reference to EBNF symbols in free text --> <!ENTITY % local.para.mix "|terminal|nonterminal"> <!ENTITY % local.para.char.mix "|terminal"> <!ENTITY % local.tabentry.mix "|terminal|nonterminal|literal"> <!ENTITY % ebnf.inline.hook "|nonterminal"> <!ENTITY % ebnf.block.hook "|productionset|constraintdef"> <!ENTITY % docbook PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> %docbook; <!ELEMENT productionset ((%formalobject.title.content;)?, (production|productionrecap)+)> <!ATTLIST productionset %common.attrib; %role.attrib; > <!ELEMENT production (lhs, rhs, constraint*)> <!ATTLIST production %idreq.common.attrib; %role.attrib; > <!-- Justus: allow emphasis --> <!ELEMENT lhs (#PCDATA|emphasis)*> <!ATTLIST lhs %common.attrib; %role.attrib; > <!-- Justus: allow terminal, literal, subscript, emphasis --> <!ELEMENT rhs (#PCDATA|nonterminal|lineannotation|sbr|terminal|literal|subscript|emphasis)*> <!ATTLIST rhs %common.attrib; %role.attrib; > <!-- Allowed to be an xpointer: you can point to non-terminals in --> <!-- other specifications. --> <!ENTITY % required-XLink-to-production-ID "def CDATA #REQUIRED"> <!ELEMENT nonterminal (#PCDATA)> <!ATTLIST nonterminal %common.attrib; %required-XLink-to-production-ID; %role.attrib; > <!-- Justus: define terminal --> <!ELEMENT terminal (#PCDATA)> <!ATTLIST terminal %common.attrib; %role.attrib; > <!-- Must be an IDREF: constraints identified in your spec must be --> <!-- represented in your spec. --> <!ENTITY % required-IDREF-to-constraintdef-ID "linkend IDREF #REQUIRED"> <!ELEMENT constraint EMPTY> <!ATTLIST constraint %common.attrib; %required-IDREF-to-constraintdef-ID; %role.attrib; > <!-- Must be an IDREF: you can only recap productions in your spec --> <!ENTITY % required-IDREF-to-production-ID "linkend IDREF #REQUIRED"> <!ELEMENT productionrecap EMPTY> <!ATTLIST productionrecap %common.attrib; %role.attrib; %required-IDREF-to-production-ID; > <!ELEMENT constraintdef (title, (%admon.mix;))> <!ATTLIST constraintdef %idreq.common.attrib; %role.attrib; > <!-- End of dbebnf.dtd V1.1CR1 ............................................ --> <!-- ...................................................................... --> -- Justus H. Piater, Ph.D. http://www.montefiore.ulg.ac.be/~piater/ Institut Montefiore, B28 Phone: +32-4-366-2279 Université de Liège, Belgium Fax: +32-4-366-2620
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]