2024-11-21 18:30:19 +01:00
|
|
|
module type PrintableType = sig
|
|
|
|
|
type t
|
|
|
|
|
val pp : out_channel -> t -> unit
|
2025-01-27 16:28:23 +01:00
|
|
|
val pp_list : out_channel -> t list -> unit
|
2024-11-21 18:30:19 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
module Node : sig
|
2024-11-27 20:18:30 +01:00
|
|
|
type t = {
|
2024-12-12 16:37:36 +01:00
|
|
|
id: int;
|
2024-11-27 20:18:30 +01:00
|
|
|
}
|
2024-11-21 18:30:19 +01:00
|
|
|
val compare : t -> t -> int
|
|
|
|
|
val create : unit -> t
|
|
|
|
|
end
|
|
|
|
|
|
2024-12-02 00:45:24 +01:00
|
|
|
module NodeMap : sig
|
|
|
|
|
include Map.S with type key = Node.t
|
|
|
|
|
|
|
|
|
|
val add_to_list_last : key -> 'a -> 'a list t -> 'a list t
|
|
|
|
|
end
|
|
|
|
|
|
2024-11-21 18:30:19 +01:00
|
|
|
module NodeSet : Set.S with type elt = Node.t
|
|
|
|
|
|
2024-12-12 16:37:36 +01:00
|
|
|
|
|
|
|
|
type 'a cfginternal = {
|
|
|
|
|
empty: bool;
|
|
|
|
|
nodes: NodeSet.t;
|
|
|
|
|
edges: (Node.t * (Node.t option)) NodeMap.t;
|
2025-01-27 16:28:23 +01:00
|
|
|
reverse_edges: (Node.t list) NodeMap.t;
|
|
|
|
|
input_val: int option;
|
|
|
|
|
input_output_var: (string * string) option;
|
2024-12-12 16:37:36 +01:00
|
|
|
initial: Node.t option;
|
|
|
|
|
terminal: Node.t option;
|
|
|
|
|
content: 'a list NodeMap.t;
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-21 18:30:19 +01:00
|
|
|
module type C = sig
|
|
|
|
|
type elt
|
2024-12-12 16:37:36 +01:00
|
|
|
type t = elt cfginternal
|
2024-11-21 18:30:19 +01:00
|
|
|
|
2024-11-27 20:18:30 +01:00
|
|
|
val empty : t
|
2024-11-21 18:30:19 +01:00
|
|
|
val merge : t -> t -> Node.t -> Node.t -> t
|
|
|
|
|
val concat : t -> t -> t
|
2025-01-27 16:28:23 +01:00
|
|
|
val add_to_last_node : elt -> t -> t
|
2024-11-21 18:30:19 +01:00
|
|
|
|
|
|
|
|
val pp : out_channel -> t -> unit
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
module Make (M: PrintableType) : C with type elt = M.t
|