Smtml.EvalSourceOperators and Evaluation Functions. This module defines types and functions for representing and evaluating various kinds of operations, including unary, binary, ternary, relational, conversion, and n-ary operations. It also defines exceptions for handling errors during evaluation.
type op_type = [ | `Unop of Ty.Unop.tUnary operation.
*)| `Binop of Ty.Binop.tBinary operation.
*)| `Relop of Ty.Relop.tRelational operation.
*)| `Triop of Ty.Triop.tTernary operation.
*)| `Cvtop of Ty.Cvtop.tConversion operation.
*)| `Naryop of Ty.Naryop.tN-ary operation.
*) ]A type representing various kinds of operations.
Exception raised when a division by zero occurs during evaluation.
Exception raised when an invalid value is encountered during evaluation.
exception TypeError of {index : int;The position of the erroneous value in the operation.
*)value : Value.t;The actual value that caused the error.
*)ty : Ty.t;The expected type.
*)op : op_type;The operation that led to the error.
*)msg : string;}Exception raised when a type error occurs during evaluation.
unop ty op v applies a unary operation op on the value v of type ty. Raises TypeError if the value does not match the expected type.
binop ty op v1 v2 applies a binary operation op on the values v1 and v2 of type ty. Raises DivideByZero if the operation involves division by zero. Raises TypeError if the values do not match the expected type.
triop ty op v1 v2 v3 applies a ternary operation op on the values v1, v2, and v3 of type ty. Raises TypeError if any value does not match the expected type.
relop ty op v1 v2 applies a relational operation op on the values v1 and v2 of type ty. Returns true if the relation holds, otherwise false. Raises TypeError if the values do not match the expected type.
cvtop ty op v applies a conversion operation op on the value v of type ty. Raises TypeError if the value does not match the expected type.
naryop ty op vs applies an n-ary operation op on the list of values vs of type ty. Raises TypeError if any value does not match the expected type.