package smtml
Install
dune-project
Dependency
Authors
-
JJoão Pereira <joaomhmpereira@tecnico.ulisboa.pt>
-
FFilipe Marques <filipe.s.marques@tecnico.ulisboa.pt>
-
HHichem Rami Ait El Hara <hra@ocamlpro.com>
-
Rredianthus <redopam@pm.me>
-
AArthur Carcano <arthur.carcano@ocamlpro.com>
-
PPierre Chambart <pierre.chambart@ocamlpro.com>
-
JJosé Fragoso Santos <jose.fragoso@tecnico.ulisboa.pt>
Maintainers
Sources
md5=9ef240b636d7059d48bb54e6b8f0a4c4
sha512=2c73a5baa2e4f8a496f575087597510edae58a4416959108e7a4b063fb9a35ae7461227c679868d82cd324865a563bd2a0df6da1fa3a88d416f76be32ea07809
doc/smtml/Smtml/Eval/index.html
Module Smtml.EvalSource
Operators 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.
Operation Types
type op_type = [ | `Unop of Ty.Unop.t(*Unary operation.
*)| `Binop of Ty.Binop.t(*Binary operation.
*)| `Relop of Ty.Relop.t(*Relational operation.
*)| `Triop of Ty.Triop.t(*Ternary operation.
*)| `Cvtop of Ty.Cvtop.t(*Conversion operation.
*)| `Naryop of Ty.Naryop.t(*N-ary operation.
*)
]A type representing various kinds of operations.
Exceptions
type type_error_info = {index : int;(*The position of the erroneous value.
*)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;
}Context payload for type errors
type error_kind = [ | `Divide_by_zero| `Conversion_to_integer| `Integer_overflow| `Index_out_of_bounds| `Invalid_format_conversion| `Unsupported_operator of op_type * Ty.t| `Unsupported_theory of Ty.t| `Type_error of type_error_info
]Classification of errors that can occur during evaluation.
Exception raised when an error occurs during concrete evaluation.
Exception raised when an invalid value is encountered during evaluation.
Evaluation Functions
unop ty op v applies a unary operation op on the value v of type ty. Raises Type_error 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.