7.2.4.2 Marking a Right-Hand Side

The #r… specifier marks a right-hand side of a production of a source PCFG. The right-hand side consists of nonterminal symbols.

The specifier has the format:

#rIndexOfRightHandSide

where IndexOfRightHandSide is a non-negative integer number. It is the identifier of a right-hand side of a nonterminal symbol in a source PCFG.

There are a few kinds of places where inserting an #r… specifier is necessary:

  1. At the end of the right-hand side of a production in a bottom-up template grammar if that right-hand side is not a set of alternatives separated by ‘|’.

    Example

    A #l-A: B C D #r0 ;
    
  2. At the end of each alternative in a set of alternatives separated by ‘|’.

    Example 1

    A #l-A: E #r2
          | F F #r0
          | G G G #r1
    ;
    

    The source PCFG productions might have the form

    A: F F
     | G G G
     | E
    ;
    

    Example 2

    A #l-A: B C D #l-_A_1C ( F F #r1
                           | G G G #r2
                           | E #r0
                           ) ...
    ;
    

    The source PCFG productions for the nonterminal symbol _A_1C might have the form

    _A_1C: E
         | F F
         | G G G
    ;
    
  3. At the end of a subexpression quantified by ‘*’.

    Example

    S #l-S: B C ( #l-_S_1A D D #r0 )* ...