productionset

productionset — A set of EBNF productions.

Synopsis

productionset ::=

Attributes

Common attributes and common linking attributes.

No additional attributes.

Additional Constraints

  • If this element is the root element, it must have a version attribute.

Description

A productionset is a collection of Extended Backus-Naur Form (EBNF) productions.

EBNF is a notation for describing the grammar of context-free languages. Even if you aren’t conversant in the programming language concepts of context-free languages and grammars, it’s not really as hard to understand as it sounds.

Processing expectations

Formatted as a displayed block. The detailed processing expectations with respect to individual productions, lefthand sides, and righthand sides are quite complex.

The productions should be numbered.

Attributes

Common attributes and common linking attributes.

any attribute

Any attribute in any other explicit namespace

Parents

These elements contain productionset: abstract, acknowledgements, annotation, answer, appendix, article, bibliodiv, bibliography, bibliolist, blockquote, callout, calloutlist, caption (db.caption), caution, chapter, colophon, constraintdef, cover, danger, dedication, entry, example, figure, footnote, glossary, glossdef, glossdiv, glosslist, important, index, indexdiv, informalexample, informalfigure, itemizedlist, legalnotice, listitem, meta (db.meta.content), msgexplan, msgtext, note, orderedlist, para, partintro, preface, procedure, qandadiv, qandaset, question, refsect1, refsect2, refsect3, refsection, refsynopsisdiv, result, revdescription, sect1, sect2, sect3, sect4, sect5, section, setindex, sidebar, simplesect, step, taskprerequisites, taskrelated, tasksummary, td, textobject, th, tip, toc, tocdiv, topic, variablelist, warning.

Children

The following elements occur in productionset: info (db.titleforbidden.info), info (db.titleonly.info), production, productionrecap, title, titleabbrev.

Examples

A set of EBNF productions describes the legal arrangements of tokens in a language. Consider arithmetic expressions as a simple example.

The expression 3 + 4 is valid and so is 3 + 4 - 5, but 3 - + - 4 is not, nor is 3 + 4 6. We can use EBNF to describe all the possible legal arrangements:

Arithemetic Expressions
[1] Expression:=ArithExpression | MultExpression Does this grammar actually get precedence right?
[2] ArithExpression:=Expression '+' MultExpression | Expression '-' MultExpression
[4] Number:=[0-9]+
Division by Zero

Division by zero is an error.

That is expressed in DocBook like this:

 1 |<article xmlns='http://docbook.org/ns/docbook'>
   |<title>Example productionset</title>
   | 
   |<simplesect><title>EBNF Grammar</title>
 5 | 
   |<productionset><title>Arithemetic Expressions</title>
   |<production xml:id="ebnf.expression">
   |  <lhs>Expression</lhs>
   |  <rhs><nonterminal def="#ebnf.arith">ArithExpression</nonterminal> |
10 |       <nonterminal def="#ebnf.mult">MultExpression</nonterminal>
   |  <lineannotation>Does this grammar actually get precedence right?
   |  </lineannotation>
   |  </rhs>
   |</production>
15 |<production xml:id="ebnf.arith">
   |  <lhs>ArithExpression</lhs>
   |  <rhs><nonterminal def="#ebnf.expression">Expression</nonterminal>
   |       '+'
   |       <nonterminal def="#ebnf.mult">MultExpression</nonterminal> |
20 |       <nonterminal def="#ebnf.expression">Expression</nonterminal>
   |       '-'
   |       <nonterminal def="#ebnf.mult">MultExpression</nonterminal>
   |  </rhs>
   |</production>
25 |<production xml:id="ebnf.mult">
   |  <lhs>MultExpression</lhs>
   |  <rhs><nonterminal def="#ebnf.mult">MultExpression</nonterminal>
   |       '*'
   |       <nonterminal def="#ebnf.mult">MultExpression</nonterminal> |
30 |       <nonterminal def="#ebnf.mult">MultExpression</nonterminal>
   |       '/'
   |       <nonterminal def="#ebnf.mult">MultExpression</nonterminal> |
   |       <nonterminal def="#ebnf.number">Number</nonterminal>
   |  </rhs>
35 |  <constraint linkend="div0"/>
   |</production>
   |<production xml:id="ebnf.number">
   |  <lhs>Number</lhs>
   |  <rhs>[0-9]+</rhs>
40 |</production>
   |</productionset>
   | 
   |<constraintdef xml:id="div0">
   |<title>Division by Zero</title>
45 |<para>Division by zero is an error.</para>
   |</constraintdef>
   |</simplesect>
   | 
   |</article>