productionset — A set of EBNF productions


Content Model

productionset ::=


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 expecations with respect to individual productions, left-hand sides, and right-hand sides are quite complex.

Productions should be numbered.


The following elements occur in productionset: info (, info (, production, productionrecap, title, titleabbrev.


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  
[3]MultExpression::=MultExpression '*' MultExpression | MultExpression '/' MultExpression | Number Division by Zero ]

Division by Zero

Division by zero is an error.

That is expressed in DocBook like this:

<article xmlns=''>
<title>Example productionset</title>

<simplesect><title>EBNF Grammar</title>

<productionset><title>Arithemetic Expressions</title>
<production xml:id="ebnf.expression">
  <rhs><nonterminal def="#ebnf.arith">ArithExpression</nonterminal> |
       <nonterminal def="#ebnf.mult">MultExpression</nonterminal>
  <lineannotation>Does this grammar actually get precedence right?
<production xml:id="ebnf.arith">
  <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>
<production xml:id="ebnf.mult">
  <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>
  <constraint linkend="div0"/>
<production xml:id="ebnf.number">

<constraintdef xml:id="div0">
<title>Division by Zero</title>
<para>Division by zero is an error.</para>



This alpha reference page is $Revision: 1.5 $ published $Date: 2005/10/31 12:31:56 $.