7.1.4.4 Ending a Nonterminal Production

Only the adaptive bottom-up parser abu-parser supports a specifier for marking the end of a production with nonterminal symbols at its right-hand side. The specifier has the format

#pn-NonterminalSymbol-RightHandSide

where NonterminalSymbol is a nonterminal symbol at the left-hand side of a production from a source PCFG, and RightHandSide is a non-negative index that identifies a right-hand side defined in a source PCFG for the nonterminal symbol. NonterminalSymbol is a string that can consist of digits, English letters, and ‘_’.

On encountering a #pn-… specifier, the parser registers an occurrence of a corresponding production from a source PCFG.

Example

Suppose a source PCFG contains this definition of the nonterminal symbol S:

S: B B
 | A B C
 | C B A
;

The right-hand side ‘B B’ has index 0, the right-hand side ‘A B C’ has index 1, and the right-hand side ‘C B A’ has index 2.

A definition of a nonterminal symbol in a top-down template grammar for parsing the source nonterminal symbol S may look like this:

C0: C1 ( ("_A" "_B" "_C" <- #d C2 #d C3 #d) #pn-S-1 < "_S" >
       | ("_B" "_B" <- #d C2 #d) #pn-S-0 < "_S" >
       | ("_C" "_B" "_A" <- #d C2 #d C4 #d) #pn-S-2 < "_S" >
       )
;

The specifiers #pn-S-0, #pn-S-1, and #pn-S-2 let the parser know about the completion of parsing the corresponding productions from the source PCFG.