7.2.3 Nonterminal Symbol Classes

A bottom-up template grammar can contain nonterminal symbol classes. They are similar to terminal symbol classes with the following differences:

  1. Nonterminal symbol classes can only be inclusive ones.
  2. The grammar must contain definitions of nonterminal symbols belonging to nonterminal symbol classes.

Nonterminal symbol classes can take part in symbol class expressions. See Symbol Class Expressions, for more information.

Example 1

[ A B C3 D ]

This is a nonterminal symbol class containing the nonterminal symbols A, B, C3, and D. The grammar should contain their definitions anywhere in its text using productions of the form

 A: ... ;
 B: ... ;
C3: ... ;
 D: ... ;

Example 2

[ L2_0 L2_1 :L1: :W: ]

This is a nonterminal symbol class containing the nonterminal symbols L2_0 and L2_1 and the named nonterminal symbol classes L1 and W. The grammar must contain definitions of the named nonterminal symbol classes earlier in its text.

A bottom-up template grammar can contain nonterminal symbol classes instead of ordinary nonterminal symbols in production right-hand sides.

Example

S: [ A B ] [ C D ]
 | [:W:] [:W:] [:W:]
;