7.1.3 Productions

A grammar production has the form

LHS: RHS ;

where the left-hand side LHS contains a nonterminal symbol, and the right-hand side RHS is an expression for the nonterminal symbol similar to a regular expression.

Every production in a grammar must contain a unique nonterminal symbol at the left-hand side.

A nonterminal symbol defined at the left-hand side of a production in a grammar is available for referencing in right-hand sides of all productions in the grammar.

The right-hand side of a production can contain:

The adaptive bottom-up parser abu-parser without passing the option --viterbi and the adaptive top-down parser atd-parser use a simple nonterminal symbol at the left-hand side of the first production in a grammar as its start nonterminal symbol.

Example

In the grammar

S: . . A B A B ;
A: . ;
B: . . ;

the nonterminal symbol S is the start one.

On passing the option --viterbi to abu-parser, it uses a simple nonterminal symbol contained in a compound nonterminal symbol located at the left-hand side of the first production to determine a set of start nonterminal symbols. The parser selects a particular start nonterminal symbol based on the length of a training parse unit counted in terminal symbols.

Example

In the grammar

S/6: . . A A ;
  A: . . ;
S/3: . . . ;
S/4: A A ;

the start nonterminal symbols are S/3, S/4, and S/6. For processing the parse unit

a b c d

the parser selects the start nonterminal symbol S/4.