-
Notifications
You must be signed in to change notification settings - Fork 0
/
syntax.mli
78 lines (67 loc) · 1.85 KB
/
syntax.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
exception TypeError
exception UnboundVariable of string
exception IndexOutOfBounds
module Env : sig
type t
val make : unit -> t
end
module IntSet : sig
type t = Range of int * int | Elements of int list
end
module Expr : sig
type t =
| Bool of bool
| Float of float
| Int of int
| Set of IntSet.t
| Var of string
| Elt of string * int
| Array of t array
| Annot of string
| Pred of string * t list
| String of string
end
module Decl : sig
type dtype =
| Bool
| Float of (float * float) option
| Int of IntSet.t option
| Set of IntSet.t option
| Array of int option * dtype
type pred_param = Param of dtype | Var of dtype
type t =
| Parameter of { dtype : dtype; name : string; value : Expr.t; }
| Variable of { dtype : dtype; name : string;
annotations : Expr.t list; value : Expr.t option;
}
| PredParam of { dtype : pred_param; name : string; }
end
module Predicate : sig
type t = { name : string; parameters : Decl.t list; }
end
val declare_parameter : Env.t -> Decl.dtype -> string -> Expr.t -> Decl.t
val declare_variable :
Env.t -> Decl.dtype -> string -> Expr.t list -> Expr.t option -> Decl.t
val declare_predicate : Env.t -> string -> Decl.t list -> Predicate.t
module Constraint : sig
type t = {
name : string;
args : Expr.t list;
annotations : Expr.t list;
}
val set : Env.t -> string -> Expr.t list -> Expr.t list -> t
end
module Goal : sig
type t =
| Satisfy of { annotations : Expr.t list; }
| Minimize of { annotations : Expr.t list; objective : Expr.t; }
| Maximize of { annotations : Expr.t list; objective : Expr.t; }
end
module Model : sig
type t = {
predicates : Predicate.t list;
declarations : Decl.t list;
constraints : Constraint.t list;
goal : Goal.t;
}
end