diff --git a/lib/miniFun/Semantics.ml b/lib/miniFun/Semantics.ml index 7451ed3..0a8fe8d 100644 --- a/lib/miniFun/Semantics.ml +++ b/lib/miniFun/Semantics.ml @@ -50,7 +50,7 @@ let rec evaluate (mem: memory) (command: t_exp) = funcClosure.assignments funcClosure.inputList parmList - in (* helper funcClosure or helper mem ??? *) + in let mem2 = ( match funcClosure.recursiveness with None -> {assignments = mem2assignments} diff --git a/lib/miniFun/Types.ml b/lib/miniFun/Types.ml index 87887bd..de36527 100644 --- a/lib/miniFun/Types.ml +++ b/lib/miniFun/Types.ml @@ -8,30 +8,30 @@ type ftype = | FunctionType of ftype list * ftype type t_exp = - Integer of int - | Boolean of bool - | Variable of variable - | Function of variable list * ftype * t_exp - | Application of t_exp * t_exp list - | Plus of t_exp * t_exp - | Minus of t_exp * t_exp - | Times of t_exp * t_exp - | Division of t_exp * t_exp - | Modulo of t_exp * t_exp - | Power of t_exp * t_exp - | PowerMod of t_exp * t_exp * t_exp - | Rand of t_exp - | BAnd of t_exp * t_exp - | BOr of t_exp * t_exp - | BNot of t_exp - | Cmp of t_exp * t_exp - | CmpLess of t_exp * t_exp - | CmpLessEq of t_exp * t_exp - | CmpGreater of t_exp * t_exp - | CmpGreaterEq of t_exp * t_exp - | IfThenElse of t_exp * t_exp * t_exp - | LetIn of variable * t_exp * t_exp - | LetFun of variable * variable list * ftype * t_exp * t_exp + Integer of int (* x := a *) + | Boolean of bool (* v *) + | Variable of variable (* x *) + | Function of variable list * ftype * t_exp (* lambda x: t. x *) + | Application of t_exp * t_exp list (* x x *) + | Plus of t_exp * t_exp (* x + x *) + | Minus of t_exp * t_exp (* x - x *) + | Times of t_exp * t_exp (* x * x *) + | Division of t_exp * t_exp (* x / x *) + | Modulo of t_exp * t_exp (* x % x *) + | Power of t_exp * t_exp (* x ^ x *) + | PowerMod of t_exp * t_exp * t_exp (* (x ^ x) % x *) + | Rand of t_exp (* rand(0, x) *) + | BAnd of t_exp * t_exp (* x and x *) + | BOr of t_exp * t_exp (* x or x *) + | BNot of t_exp (* not x *) + | Cmp of t_exp * t_exp (* x == x *) + | CmpLess of t_exp * t_exp (* x < x *) + | CmpLessEq of t_exp * t_exp (* x <= x *) + | CmpGreater of t_exp * t_exp (* x > x *) + | CmpGreaterEq of t_exp * t_exp (* x >= x *) + | IfThenElse of t_exp * t_exp * t_exp (* if b then c else c *) + | LetIn of variable * t_exp * t_exp (* let x = x in x *) + | LetFun of variable * variable list * ftype * t_exp * t_exp (* let rec x: t. x in x*) type permittedValues = IntegerPermitted of int