productionset — A set of EBNF productions
productionset ::=
((((title
? &
titleabbrev
?),
info
? db.titleforbidden.info) |
info
db.titleonly.info),
(production
|
productionrecap
)+)
A productionset
is a collection of
Extended Backus-Naur Form (EBNF)
production
s.
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.
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.
That is expressed in DocBook like this:
<article xmlns='http://docbook.org/ns/docbook'> <title>Example productionset</title> <simplesect><title>EBNF Grammar</title> <productionset><title>Arithemetic Expressions</title> <production xml:id="ebnf.expression"> <lhs>Expression</lhs> <rhs><nonterminal def="#ebnf.arith">ArithExpression</nonterminal> | <nonterminal def="#ebnf.mult">MultExpression</nonterminal> <lineannotation>Does this grammar actually get precedence right? </lineannotation> </rhs> </production> <production xml:id="ebnf.arith"> <lhs>ArithExpression</lhs> <rhs><nonterminal def="#ebnf.expression">Expression</nonterminal> '+' <nonterminal def="#ebnf.mult">MultExpression</nonterminal> | <nonterminal def="#ebnf.expression">Expression</nonterminal> '-' <nonterminal def="#ebnf.mult">MultExpression</nonterminal> </rhs> </production> <production xml:id="ebnf.mult"> <lhs>MultExpression</lhs> <rhs><nonterminal def="#ebnf.mult">MultExpression</nonterminal> '*' <nonterminal def="#ebnf.mult">MultExpression</nonterminal> | <nonterminal def="#ebnf.mult">MultExpression</nonterminal> '/' <nonterminal def="#ebnf.mult">MultExpression</nonterminal> | <nonterminal def="#ebnf.number">Number</nonterminal> </rhs> <constraint linkend="div0"/> </production> <production xml:id="ebnf.number"> <lhs>Number</lhs> <rhs>[0-9]+</rhs> </production> </productionset> <constraintdef xml:id="div0"> <title>Division by Zero</title> <para>Division by zero is an error.</para> </constraintdef> </simplesect> </article>