grew_grs.mli 1.78 KB
Newer Older
bguillaum's avatar
bguillaum committed
1 2 3 4
open Grew_utils
open Grew_graph
open Grew_rule
open Grew_ast
bguillaum's avatar
bguillaum committed
5

pj2m's avatar
pj2m committed
6 7 8 9 10 11 12 13
module Rewrite_history: sig
  type t = {
      instance: Instance.t;
      module_name: string; 
      good_nf: t list;
      bad_nf: Instance.t list;
    }

bguillaum's avatar
bguillaum committed
14
  val is_empty: t -> bool
bguillaum's avatar
bguillaum committed
15 16

  val num_sol: t -> int
17
    
bguillaum's avatar
bguillaum committed
18 19 20 21 22
  (** [save_nfs ?main_feat base_name t] does two things:
      - write PNG files of normal forms
      - returns a list of couples (rules, file)
  *)
  val save_nfs:
23
    ?main_feat: string -> 
bguillaum's avatar
bguillaum committed
24
    dot: bool ->
25 26
    string -> 
    t -> 
bguillaum's avatar
bguillaum committed
27
    ((string * string list) list * string) list
28

29 30
  (** [save_gr base_name t] saves one gr_file for each normal form defined in [t].
      Output files are named according to [base_name] and the Gorn adress in the rewriting tree. *)
31
  val save_gr: string -> t -> unit
bguillaum's avatar
bguillaum committed
32
  val save_conll: string -> t -> unit
33 34 35 36

  (** [save_det_gr base_name t] supposes that the current GRS is deterministic.
      It writes exactly one output file named [base_name].gr with the unique normal form. *)
  val save_det_gr: string -> t -> unit
bguillaum's avatar
bguillaum committed
37
  val save_det_conll: string -> t -> unit
pj2m's avatar
pj2m committed
38 39
end

bguillaum's avatar
bguillaum committed
40 41 42
module Modul: sig
  type t = {
    name: string;
43
    local_labels: (string * string list) array;
bguillaum's avatar
bguillaum committed
44 45 46 47 48
    rules: Rule.t list;
    filters: Rule.t list;
    confluent: bool;
    loc: Loc.t;
  }
49
end
pj2m's avatar
pj2m committed
50

bguillaum's avatar
bguillaum committed
51 52


pj2m's avatar
pj2m committed
53 54 55 56 57
module Grs: sig
  type t

  val empty:t
  
bguillaum's avatar
bguillaum committed
58 59
  val get_modules: t -> Modul.t list

60
  val sequence_names: t -> string list
pj2m's avatar
pj2m committed
61 62 63 64 65 66 67

  val build: Ast.grs -> t

  val rewrite: t -> string -> Instance.t -> Rewrite_history.t

  (* only externeal strucutre is returned, each edge contains a "dummy" big_step *)
  val build_rew_display: t -> string -> Instance.t -> Grew_types.rew_display
bguillaum's avatar
bguillaum committed
68 69

  val rule_iter: (string -> Rule.t -> unit) -> t -> unit
bguillaum's avatar
bguillaum committed
70
  val filter_iter: (string -> Rule.t -> unit) -> t -> unit
bguillaum's avatar
bguillaum committed
71

bguillaum's avatar
bguillaum committed
72
  val modules_of_sequence: t -> string -> Modul.t list
bguillaum's avatar
bguillaum committed
73
end