grew_rule.mli 1.14 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	

20
  (* 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
21 22 23
  val rev_steps: t -> t

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

pj2m's avatar
pj2m committed
27
IFDEF DEP2PICT THEN
pj2m's avatar
pj2m committed
28 29
  (* [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
30
ENDIF
pj2m's avatar
pj2m committed
31 32 33 34 35 36 37
end

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

module Rule : sig
  type t

bguillaum's avatar
bguillaum committed
38 39
  val get_name: t -> string

40 41
  val get_loc: t -> Loc.t

pj2m's avatar
pj2m committed
42 43 44 45 46 47 48 49 50 51
  val build: ?domain:Ast.domain -> ?locals:Label.decl array -> Ast.rule -> t

  (* raise Stop if some command fails to apply *)
  val normalize: 
    ?confluent:bool -> 
    t list ->
    (Instance_set.elt -> bool) ->
    Instance.t ->
      Instance_set.t * Instance_set.t
end