Module Bir_interpreter.FloatMfInterp

Comes from the instantiation of the functor by a kind of floating-point value

type value =
| Number of custom_float
| Undefined

Functor-specific program values

val format_value : Stdlib.Format.formatter -> value -> unit
val format_value_prec : int -> int -> Stdlib.Format.formatter -> value -> unit
type var_value =
| SimpleVar of value
| TableVar of int * value array

Functor-specific variable values

val format_var_value : Stdlib.Format.formatter -> var_value -> unit
val format_var_value_prec : int -> int -> Stdlib.Format.formatter -> var_value -> unit
val format_var_value_with_var : Stdlib.Format.formatter -> (Bir.variable * var_value) -> unit
type print_ctx = {
indent : int;
is_newline : bool;
}
type ctx = {
ctx_local_vars : value Pos.marked Mir.LocalVariableMap.t;
ctx_vars : var_value Bir.VariableMap.t;
ctx_it : Mir.variable IntMap.t;
ctx_pr_out : print_ctx;
ctx_pr_err : print_ctx;
ctx_anos : (Mir.error * string option) list;
ctx_old_anos : StrSet.t;
ctx_nb_anos : int;
ctx_nb_discos : int;
ctx_nb_infos : int;
ctx_nb_bloquantes : int;
ctx_finalized_anos : (Mir.error * string option) list;
ctx_exported_anos : (Mir.error * string option) list;
}

Interpretation context

val empty_ctx : ctx
val literal_to_value : Mir.literal -> value
val var_literal_to_var_value : var_literal -> var_value
val value_to_literal : value -> Mir.literal
val var_value_to_var_literal : var_value -> var_literal
val update_ctx_with_inputs : ctx -> Mir.literal Bir.VariableMap.t -> ctx
val complete_ctx : ctx -> Mir.VariableDict.t -> ctx
type run_error =
| NanOrInf of string * Bir.expression Pos.marked
| StructuredError of string * (string option * Pos.t) list * ( unit -> unit ) option

Interpreter runtime errors

exception RuntimeError of run_error * ctx
val raise_runtime_as_structured : run_error -> 'a

Raises a runtime error with a formatted error message and context

val compare_numbers : Mast.comp_op -> custom_float -> custom_float -> bool

Returns the comparison between two numbers in the rounding and precision context of the interpreter.

val evaluate_expr : ctx -> Mir.program -> Bir.expression Pos.marked -> value
val evaluate_program : Bir.program -> ctx -> int -> ctx