summaryrefslogtreecommitdiff
path: root/interpret/interface.ml
diff options
context:
space:
mode:
Diffstat (limited to 'interpret/interface.ml')
-rw-r--r--interpret/interface.ml40
1 files changed, 40 insertions, 0 deletions
diff --git a/interpret/interface.ml b/interpret/interface.ml
new file mode 100644
index 0000000..7b84396
--- /dev/null
+++ b/interpret/interface.ml
@@ -0,0 +1,40 @@
+open Ast
+
+
+module type INTERPRET = sig
+
+
+ exception Bad_datatype
+ type value
+
+ val int_value : int -> value
+ val bool_value : bool -> value
+ val real_value : float -> value
+
+ val as_int : value -> int
+ val as_bool : value -> bool
+ val as_real : value -> float
+
+ val str_repr_of_val : value -> string
+
+ type state
+
+ val print_state : Format.formatter -> state -> unit
+
+ type io = (id * value) list
+
+ (*
+ Construct initial state for a program.
+ The id is the root node of the program evaluation.
+ *)
+ val init_state : prog -> id -> state
+
+ (*
+ Run a step of the program (not necessary to specify the program,
+ it should be encoded in the state).
+ State -> Inputs -> Next state, Outputs
+ *)
+ val step : state -> io -> (state * io)
+
+end
+