-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheval.mli
executable file
·23 lines (21 loc) · 1.02 KB
/
eval.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
open Type;;
(*
(* Return the result of the operation of two expression *)
val eval_operation : op -> int -> int -> int
(* Return a bool which represents the result of the comparaison *)
val eval_comparaison : int -> comp -> int -> bool
(* Return an int which reprents the result of an expression *)
val eval_expression : expr -> int Table.t -> int
(* Return a bool which represents the result of the condition *)
val eval_condition : cond -> int Table.t -> bool
(*
Evaluates the instruction/block given as argument. All instructions are trivial but
if and while. For if, we just need to check if the condition is valid, if it is,
eval first part of the block (the if part). Else, the second part (the else part)
While will just get looped in an auxiliary function if the condition is still true.
Mutual recursion makes a purely functional approach to evaluation.
*)
val eval_instr : instr -> int Table.t -> int Table.t
*)
val eval_block : block -> int Table.t -> int Table.t
val eval_comparaison : int -> comp -> int -> bool