7.1 Top-Down Template Grammar

A top-down template grammar can consist of the following elements:

Every production defines a nonterminal symbol located at its left-hand side. A nonterminal symbol at the left-hand side of the first production in the grammar is a start nonterminal symbol. The grammar must contain at least one production.

On passing the option --viterbi to the adaptive bottom-up parser abu-parser, it expects for the name of a start nonterminal symbol to contain a stem name and parse unit length counted in terminal symbols (see Nonterminal Symbols, for more information on this parse unit length specification). In this case, start nonterminal symbols are all nonterminal symbols with this stem name. The bottom-up parser selects a particular start nonterminal symbol based on the length of a particular parse unit.

Nonterminal symbols defined by productions and copying assignments are visible in right-hand sides of all productions. Nonterminal symbols in right-hand sides of copying assignments require prior definition by productions or copying assignments. Named terminal symbol classes in right-hand sides of productions and right-hand sides of terminal symbol class assignments require definition by preceding terminal symbol class assignments.

The grammar can contain end-of-line comments starting with ‘//’ and comments enclosed in ‘/*’ and ‘*/’.