Refactoring, errors are not thrown anymore
This commit is contained in:
@ -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
|
||||
@ -48,8 +48,10 @@ type memory = {
|
||||
assignments: permittedValues VariableMap.t
|
||||
}
|
||||
|
||||
exception AbsentAssignment of string
|
||||
exception WrongType of string
|
||||
exception DivisionByZero of string
|
||||
exception WrongArity of string
|
||||
exception WrongTypeSpecification of string
|
||||
type error = [
|
||||
`AbsentAssignment of string
|
||||
| `WrongType of string
|
||||
| `DivisionByZero of string
|
||||
| `WrongArity of string
|
||||
| `WrongTypeSpecification of string
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user