grew_ast.mli 2.98 KB
Newer Older
bguillaum's avatar
bguillaum committed
1 2 3 4 5 6 7 8 9
open Grew_utils
 
module Ast : sig
  type feature_spec = 
    | Closed of string * string list (* (the name, the set of atomic values) *)
    | Open of string (* the name *)
          
  type domain = feature_spec list
        
bguillaum's avatar
bguillaum committed
10 11 12 13
  type feature_kind = 
    | Equality of string list 
    | Disequality of string list
    | Param of string
bguillaum's avatar
bguillaum committed
14 15 16

  type u_feature = {
      name: string;
bguillaum's avatar
bguillaum committed
17
      kind: feature_kind;
bguillaum's avatar
bguillaum committed
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
    }  

  type feature = u_feature * Loc.t

(* qualified feature name "A.lemma" *)
  type qfn = string * string

  type u_node = {
      node_id: Id.name;
      position: int option;
      fs: feature list;
    }

  type node = u_node * Loc.t


  type u_edge = {
      edge_id: Id.name option;
      src: Id.name;
      edge_labels: string list;
      tar: Id.name;
      negative: bool;
    }

  type edge = u_edge * Loc.t

  type u_const = 
    | Start of Id.name * string list (* (source, labels) *)
    | No_out of Id.name
    | End of Id.name * string list (* (target, labels) *)
    | No_in of Id.name
    | Feature_eq of qfn * qfn

  type const = u_const * Loc.t

  type pattern = {
      pat_nodes: node list;
      pat_edges: edge list;
      pat_const: const list;
    }

  type concat_item =
    | Qfn_item of (string * string)
    | String_item of string
62
    | Param_item of string
bguillaum's avatar
bguillaum committed
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
          
  type u_command = 
    | Del_edge_expl of (Id.name * Id.name * string)
    | Del_edge_name of string
    | Add_edge of (Id.name * Id.name * string)
    | Shift_in of (Id.name*Id.name)
    | Shift_out of (Id.name*Id.name)
    | Shift_edge of (Id.name*Id.name)
    | Merge_node of (Id.name*Id.name)
    | New_neighbour of (Id.name * Id.name * string)
    | Del_node of Id.name

    | Del_feat of qfn
    | Update_feat of qfn * concat_item list

  type command = u_command * Loc.t
  type rule = {
      rule_id:Id.name;
      pos_pattern: pattern;
      neg_patterns: pattern list;
      commands: command list;
bguillaum's avatar
bguillaum committed
84
      param: (string*string list) option;
bguillaum's avatar
bguillaum committed
85
      rule_doc:string list;
bguillaum's avatar
bguillaum committed
86 87 88 89 90 91 92 93
      rule_loc: Loc.t;
    }
        
  type modul = {
      module_id:Id.name;
      local_labels: (string * string option) list;
      rules: rule list;
      confluent: bool;
bguillaum's avatar
bguillaum committed
94
      module_doc:string list;
bguillaum's avatar
bguillaum committed
95
      mod_loc:Loc.t;
96
      mod_dir: string; (* the directory where the module is defined (for lp file localisation) *)
bguillaum's avatar
bguillaum committed
97 98 99 100 101
    }
        
  type sequence = {
      seq_name:string;
      seq_mod:string list;
bguillaum's avatar
bguillaum committed
102
      seq_doc:string list;
bguillaum's avatar
bguillaum committed
103 104 105 106 107 108 109 110
      seq_loc:Loc.t;
    }
        
(** 
    a GRS: graph rewriting system 
 *)
  type module_or_include = 
    | Modul of modul
111
    | Includ of (string * Loc.t)
bguillaum's avatar
bguillaum committed
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131

  type grs_with_include = {
      domain_wi: domain;
      labels_wi: (string * string option) list;    (* the list of global edge labels *)
      modules_wi: module_or_include list; 
      sequences_wi: sequence list;
    }

  type grs = {
      domain: domain;
      labels: (string * string option) list;
      modules: modul list;
      sequences: sequence list;
    }

  type gr = {
      nodes: node list;
      edges: edge list;
    }
end (* module Ast *)