Class Grammar.reconstruct_pat


class reconstruct_pat : int -> int array -> object  end
Rule reconstruction pattern (used to reconstruct parse trees; one such pattern exists for every rule, more or less). A reconstruct_pat tells what to look for given that the head category of the rule was found in the chart (the found item will be referred to in the comments below as the "left-hand-side item") to decide whether the referenced rule was used in the and if it *was* used, to decide what the elements that combined to form the head category were. It consists of a listing of what states in the categories on the right hand side of the rule are set from the states in the head of the rule, plus equivalences between states in the right hand side. An equivalence is between state x of rhs item y and state z of rhs item w... We supply as args the number of rhs elements and an array of arities [| <head arity>; <1st rhs el arity>; [<2nd rhs el arity>] |].

num_rhs : Number of RHS elements (1 or 2)
arities : Arities of rule elements (see above)

method set_rhs_state : int -> int -> int -> unit
Indicates that the jth state of the ith element of the right hand side comes from the stth state in the left-hand-side element
Returns nothing

i : Indicated element of the right hand side of the rule
j : Indicated state of the indicated element
st : Output item state the right-hand-side state comes from or, alternatively, produces
method get_rhs_state : int -> int -> int
Returns which of the left-hand-side element's states is the origin of the jth state of the ith element of the right hand side. The value is -1 if that state is set by equivalence relations rather than directly from the left-hand-side element.

i : Indicated element of the right hand side of the rule
j : Indicated state of the indicated element
method set_eqv : int * int -> int * int -> unit
Modifies this pattern to note that the indicated RHS element states are equivalent, that is, are required to be identical.
Returns nothing

(el1,st1) : st1 : Indicated state of 1st indicated RHS element
el1 : First indicated RHS element
(el2,st2) : st2 : Indicated state of the 2nd indicated RHS element
el2 : Second indicated RHS element
method is_eqv : int * int -> int * int -> bool
Returns whether the indicated states are required to match.

(el1,st1) : st1 : Indicated state of 1st indicated RHS element
el1 : First indicated RHS element
(el2,st2) : st2 : Indicated state of the 2nd indicated RHS element
el2 : Second indicated RHS element
method fill_pat_unary : rule_pat -> unit
Fills in pat with as much information as possible, using the information stored in this. This will only be useful to the extent that this reconstruction pattern has already been filled with information! This method is specific to chain rules.
Returns nothing

pat : Pattern to be used in parsing for the rule this pattern will be reconstructing after parsing is done.
method fill_pat_binary : rule_pat -> rule_pat -> unit
Fills in pat1 and pat2 with as much information as possible, using the information stored in this. This will only be useful to the extent that this reconstruction pattern has already been filled with information! This method is specific to binary rules.
Returns nothing

pat1 : Pattern to be used in parsing for the rule this pattern will be reconstructing after parsing is done. This pattern is the one that represents the rightmost RHS element as a triggering item.
pat2 : Pattern representing the leftmost RHS element as a triggering item.
method unify_unary : Chart.subitem -> unit
Makes use of equivalences to fill out item.
Raises Ununifiable if the item cannot be unified (states that need to be equal cannot be made so)
Returns nothing

item : Item to be filled out via equivalences; from chain rule.
method unify_binary : Chart.subitem -> Chart.subitem -> Chart.subitem
Makes use of equivalences to fill out item1 and item2.
Raises Ununifiable if the items cannot be filled out.
Returns the filled-out version of item1

item1 : First RHS element.
item2 : Second RHS element.
method output_self : unit -> unit
Shows the reconstruction pattern in human-readable format.
Returns nothing