sig
  class rule :
    object
      method headcat : int
      method length : int
      method maptype : int
      method rhs : int array
      method set_headcat : int -> unit
      method set_maptype : int -> unit
      method set_rhs : int -> int -> unit
    end
  class rule_pat :
    int ->
    int ->
    int ->
    int array ->
    bool ->
    object
      method check_item : Chart.subitem -> bool
      method check_other_item : Chart.subitem -> bool
      method get_other_cat : int
      method get_other_state : int -> int
      method get_out_cat : int
      method get_rule_num : int
      method get_state : int -> int
      method multi_cat_pat : unit -> bool
      method out_item : Chart.subitem -> Chart.subitem -> Chart.subitem
      method output_self : int -> unit
      method search_item : Chart.subitem -> Chart.subitem
      method set_check_state : int -> int -> unit
      method set_other_cat : int -> unit
      method set_other_state : int -> int -> unit
      method set_out_state : int -> int * int -> unit
      method set_state : int -> int -> unit
    end
  class reconstruct_pat :
    int ->
    int array ->
    object
      method fill_pat_binary : Grammar.rule_pat -> Grammar.rule_pat -> unit
      method fill_pat_unary : Grammar.rule_pat -> unit
      method get_rhs_state : int -> int -> int
      method is_eqv : int * int -> int * int -> bool
      method output_self : unit -> unit
      method set_eqv : int * int -> int * int -> unit
      method set_rhs_state : int -> int -> int -> unit
    end
  type map_item = int * int
  and mapfunc = Grammar.map_item list array
  val is_terminal : Grammar.rule -> bool
  exception Duplicate_category
  exception Unknown_terminal of string
  class grammar :
    object
      method add_mapping_func : Grammar.mapfunc -> int
      method add_rule : Grammar.rule -> unit
      method arity : int -> int
      method arity_of_type : int -> int
      method base_cat : int -> int
      method build_patterns : unit -> unit
      method cat_string : int -> string
      method check_rules : unit -> unit
      method del_rule : int -> unit
      method get_rule : int -> Grammar.rule
      method is_empty_cat : int -> bool
      method is_nonempty_cat : int -> bool
      method lookup_base_cat : string -> int
      method mapping_function : int -> Grammar.mapfunc
      method new_base_category : string -> int
      method new_category : int -> int
      method new_terminal : string -> int
      method num_base_cats : int
      method num_cats : int
      method num_rules : int
      method output_rule : int -> unit
      method output_rules : unit -> unit
      method patterns : int -> Grammar.rule_pat list
      method reconstruction_pattern : int -> Grammar.reconstruct_pat
      method rules_headed_by : int -> int list
      method set_arity : int -> int -> unit
      method set_empty_cat : int -> bool -> unit
      method set_nonempty_cat : int -> bool -> unit
      method set_start_cat : int -> unit
      method start_cat : int
      method terminal_id : string -> int
      method terminal_name : int -> string
    end
end