grew_rule.mli 1.68 KB
Newer Older
bguillaum's avatar
bguillaum committed
1 2 3
open Grew_utils
open Grew_graph
open Grew_command
pj2m's avatar
pj2m committed
4 5
open Grew_edge
open Grew_fs
bguillaum's avatar
bguillaum committed
6
open Grew_ast
pj2m's avatar
pj2m committed
7 8 9

module Instance : sig
  type t = {
10
      graph: G_graph.t;
pj2m's avatar
pj2m committed
11 12
      commands: Command.h list;
      rules: string list;
bguillaum's avatar
bguillaum committed
13
      big_step: Grew_types.big_step option;
pj2m's avatar
pj2m committed
14
    }
bguillaum's avatar
bguillaum committed
15

pj2m's avatar
pj2m committed
16 17 18 19
  val empty:t

  val build: Ast.gr -> t	

bguillaum's avatar
bguillaum committed
20
  val of_conll: ?loc:Loc.t -> Conll.line list -> t
bguillaum's avatar
bguillaum committed
21

bguillaum's avatar
bguillaum committed
22
  (* rev_steps reverse the small step list: during rewriting, the last rule is in the head of the list and the reverse is needed for display *)
pj2m's avatar
pj2m committed
23 24
  val rev_steps: t -> t

bguillaum's avatar
bguillaum committed
25
  val clear: t -> t
26 27
  val from_graph: G_graph.t -> t
  val get_graph: t -> G_graph.t
pj2m's avatar
pj2m committed
28

29 30
  val to_gr: t -> string

31 32
  (* [save_dep_png base t] writes a file "base.png" with the dep representation of [t].
     NB: if the Dep2pict is not available, nothing is done *)
pj2m's avatar
pj2m committed
33
  val save_dep_png: ?main_feat: string -> string -> t -> unit
34 35 36 37 38 39

  (* [save_dot_png base t] writes a file "base.png" with the dot representation of [t] *)
  val save_dot_png: ?main_feat: string -> string -> t -> unit



pj2m's avatar
pj2m committed
40 41 42 43 44 45 46
end

module Instance_set : Set.S with type elt = Instance.t

module Rule : sig
  type t

bguillaum's avatar
bguillaum committed
47 48
  val get_name: t -> string

bguillaum's avatar
bguillaum committed
49
  (** [get_loc t] returns the file location of the rule [t]. *)
50 51
  val get_loc: t -> Loc.t

52 53
  val is_filter: t -> bool

bguillaum's avatar
bguillaum committed
54 55
  val to_dep: t -> string

56 57 58
  (** [build ?local dir ast_rule] returns the Rule.t value corresponding to [ast_rule].
      [dir] is used for localisation of lp files *)
  val build: ?locals:Label.decl array -> string -> Ast.rule -> t
pj2m's avatar
pj2m committed
59 60

  (* raise Stop if some command fails to apply *)
61 62
  val normalize:
    string -> (* module name *)
bguillaum's avatar
bguillaum committed
63
    ?confluent:bool ->
64 65
    t list -> (* rule list *)
    t list -> (* filter list *)
pj2m's avatar
pj2m committed
66 67
    Instance.t ->
      Instance_set.t * Instance_set.t
68

pj2m's avatar
pj2m committed
69
end