Mlang.Bir_interpreter
Interpretation of BIR programs
The BIR interpreter can be instrumented to record which program locations have been executed.
type code_location_segment =
| InsideBlock of int |
| ConditionalBranch of bool |
| InsideRule of Bir.rov_id |
| InsideFunction of Bir.function_name |
| InsideIterate of Bir.variable |
Representation of each program location segment
val format_code_location_segment :
Stdlib.Format.formatter ->
code_location_segment ->
unit
type code_location = code_location_segment list
A program location is simply the path inside the program
val format_code_location : Stdlib.Format.formatter -> code_location -> unit
val assign_hook :
( Bir.variable ->
( unit -> var_literal ) ->
code_location ->
unit )
Stdlib.ref
The instrumentation of the interpreter is done through this reference. The function that you assign to this reference will be called each time a variable assignment is executed
If set to true, the interpreter exits the whole process in case of runtime error
The intepreter is parametrized by the kind of floating-point values used for the execution
module type S = sig ... end
Signature of the modules produced by the functor
module FloatDefInterp :
S with type custom_float = Bir_number.RegularFloatNumber.t
The different interpreters, which combine a representation of numbers and rounding operations. The first part of the name corresponds to the representation of numbers, and is one of the following:
module FloatMultInterp :
S with type custom_float = Bir_number.RegularFloatNumber.t
module FloatMfInterp :
S with type custom_float = Bir_number.RegularFloatNumber.t
module MPFRDefInterp : S with type custom_float = Bir_number.MPFRNumber.t
module MPFRMultInterp : S with type custom_float = Bir_number.MPFRNumber.t
module MPFRMfInterp : S with type custom_float = Bir_number.MPFRNumber.t
module BigIntDefInterp : S
module BigIntMultInterp : S
module BigIntMfInterp : S
module IntvDefInterp : S with type custom_float = Bir_number.IntervalNumber.t
module IntvMultInterp : S with type custom_float = Bir_number.IntervalNumber.t
module IntvMfInterp : S with type custom_float = Bir_number.IntervalNumber.t
module RatDefInterp : S with type custom_float = Bir_number.RationalNumber.t
module RatMultInterp : S with type custom_float = Bir_number.RationalNumber.t
module RatMfInterp : S with type custom_float = Bir_number.RationalNumber.t
val get_interp : Cli.value_sort -> Cli.round_ops -> (module S)
val evaluate_program :
Bir.program ->
Mir.literal Bir.VariableMap.t ->
Cli.value_sort ->
Cli.round_ops ->
float option StrMap.t * StrSet.t
Main interpreter function
val evaluate_expr :
Mir.program ->
Bir.expression Pos.marked ->
Cli.value_sort ->
Cli.round_ops ->
Mir.literal
Interprets only an expression