package asli

  1. Overview
  2. Docs

Module LibASL.ValueSource

ASL interpreter values

Sourcemodule AST = Asl_ast

Values

This union type is for use in an interpreter

Sourcetype value =
  1. | VBool of bool
  2. | VEnum of LibASL.Asl_utils.AST.ident * int
  3. | VInt of Primops.bigint
  4. | VReal of Primops.real
  5. | VBits of Primops.bitvector
  6. | VMask of Primops.mask
  7. | VString of string
  8. | VExc of LibASL.Asl_utils.AST.l * Primops.exc
  9. | VTuple of value list
  10. | VRecord of value Asl_utils.Bindings.t
  11. | VArray of value Primops.ImmutableArray.t * value
  12. | VRAM of Primops.ram
  13. | VUninitialized

Exceptions thrown by interpreter

Sourceexception Return of value option
Sourceexception EvalError of LibASL.Asl_utils.AST.l * string

Printer for values

Sourceval pp_value : value -> string

Functions on values

Sourceval from_bool : bool -> value
Sourceval to_bool : LibASL.Asl_utils.AST.l -> value -> bool
Sourceval to_int : LibASL.Asl_utils.AST.l -> value -> int
Sourceval to_string : LibASL.Asl_utils.AST.l -> value -> string
Sourceval to_tuple : value list -> value
Sourceval of_tuple : LibASL.Asl_utils.AST.l -> value -> value list
Sourceval mkrecord : (LibASL.Asl_utils.AST.ident * value) list -> value
Sourceval empty_array : value -> value
Sourceval set_array : LibASL.Asl_utils.AST.l -> value -> value -> value -> value
Sourceval drop_chars : string -> char -> string

Delete all characters matching 'c' from string 'x'

Sourceval from_stringLit : string -> value

Primop dispatch on values

Returns None iff function does not exist or arguments have wrong type

Sourceval eval_prim : string -> value list -> value list -> value option

Utility functions on Values

Sourceval extract_bits : LibASL.Asl_utils.AST.l -> value -> value -> value -> value
Sourceval extract_bits' : LibASL.Asl_utils.AST.l -> value -> int -> int -> value
Sourceval extract_bits'' : LibASL.Asl_utils.AST.l -> value -> value -> value -> value
Sourceval insert_bits : LibASL.Asl_utils.AST.l -> value -> value -> value -> value -> value
Sourceval insert_bits' : LibASL.Asl_utils.AST.l -> value -> int -> int -> value -> value
Sourceval eval_eq : LibASL.Asl_utils.AST.l -> value -> value -> bool
Sourceval eval_leq : LibASL.Asl_utils.AST.l -> value -> value -> bool
Sourceval eval_eq_int : LibASL.Asl_utils.AST.l -> value -> value -> bool
Sourceval eval_eq_bits : LibASL.Asl_utils.AST.l -> value -> value -> bool
Sourceval eval_inmask : LibASL.Asl_utils.AST.l -> value -> value -> bool
Sourceval eval_add_int : LibASL.Asl_utils.AST.l -> value -> value -> value
Sourceval eval_sub_int : LibASL.Asl_utils.AST.l -> value -> value -> value
Sourceval eval_concat : LibASL.Asl_utils.AST.l -> value list -> value

Unknown handling

We might want to change this in the future to model the expected non-determinism in the spec. And we might want to augment this with some form of support for uninitialized values (which would ideally trigger an error).

Sourceval eval_unknown_bits : Primops.bigint -> value
Sourceval eval_unknown_ram : Primops.bigint -> value
Sourceval eval_unknown_integer : unit -> value
Sourceval eval_unknown_real : unit -> value
Sourceval eval_unknown_string : unit -> value
OCaml

Innovation. Community. Security.