grew_rule.mli 1.5 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 13 14
      commands: Command.h list;
      rules: string list;
      big_step: Grew_types.big_step option; 
    }
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

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 25
  val rev_steps: t -> t

  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

pj2m's avatar
pj2m committed
31
IFDEF DEP2PICT THEN
pj2m's avatar
pj2m committed
32 33
  (* [save_dep_png base t] writes a file "base.png" with the dep representation of [t] *)
  val save_dep_png: ?main_feat: string -> string -> t -> unit
pj2m's avatar
pj2m committed
34
ENDIF
pj2m's avatar
pj2m committed
35 36 37 38 39 40 41
end

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

module Rule : sig
  type t

bguillaum's avatar
bguillaum committed
42 43
  val get_name: t -> string

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

47 48
  val is_filter: t -> bool

bguillaum's avatar
bguillaum committed
49 50
  val to_dep: t -> string

51 52 53
  (** [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
54 55

  (* raise Stop if some command fails to apply *)
56 57
  val normalize:
    string -> (* module name *)
pj2m's avatar
pj2m committed
58
    ?confluent:bool -> 
59 60
    t list -> (* rule list *)
    t list -> (* filter list *)
pj2m's avatar
pj2m committed
61 62
    Instance.t ->
      Instance_set.t * Instance_set.t
63

pj2m's avatar
pj2m committed
64
end