Class Grammar.rule


class rule : object  end
This consists of a head category, one or two right-hand categories, and a map function, here just the index of the map function in the grammar's list of map functions.

method set_headcat : int -> unit
Sets the head category to cat
Returns nothing

cat : Head category
method set_rhs : int -> int -> unit
Sets the ith RHS element to cat
Returns nothing

i : Right hand side element to set
cat : Category to put at rhs# idx.
method set_maptype : int -> unit
Notes that the mapping function is indexed as number typ in the grammar this rule is stored in.
Returns nothing

typ : Map function type of this rule.
method headcat : int
Returns the head category
method rhs : int array
Returns array of RHS NT cats or T ids
method maptype : int
Returns mapping function type (0 for T)
method length : int
Returns length of rhs array