productionset
Prev | DocBook Element Reference | Next

This is an alpha version of this book.

# productionset

## Name

productionset — A set of EBNF productions

##

# Synopsis

### Content Model

    productionset ::=
    ((title,titleabbrev?)?,
     (production|productionrecap)+)

### Attributes

Common attributes

### Parameter Entities

The following parameter entities contain productionset:

Parameter Entities
`%bookcomponent.content;` | `%component.mix;` | `%compound.class;`
`%divcomponent.mix;` | `%ebnf.block.hook;` | `%refcomponent.mix;`

## Description

This element is only available if you are using the EBNF Module.

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:

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 | [ Err: Division by Zero ]
[4] | Number | `::=` | [0-9]+ |

Division by Zero

Division by zero is an error. Constraints, such as this one, are used to express conditions that cannot be expressed in the grammar.

### 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.

`Production`s should be numbered.

### Parents

These elements contain productionset: `appendix`, `article`, `bibliodiv`, `bibliography`, `blockquote`, `callout`, `chapter`, `glossary`, `glossdiv`, `index`, `listitem`, `msgexplan`, `msgtext`, `partintro`, `preface`, `procedure`, `refsect1`, `refsect2`, `refsect3`, `refsynopsisdiv`, `sect1`, `sect2`, `sect3`, `sect4`, `sect5`, `section`, `setindex`, `simplesect`, `step`.

### Children

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

## Examples

    <!DOCTYPE productionset PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
              "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
    <productionset><title>Arithemetic Expressions</title>
    <production 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 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 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 id="ebnf.number">
      <lhs>Number</lhs>
      <rhs>[0-9]+</rhs>
    </production>
    </productionset>

Prev | Home | Next
productionrecap | Up | productname

Copyright © 1999, 2000, 2001 O'Reilly & Associates, Inc.