package rfsm

  1. Overview
  2. Docs

Expressions and values

type t = {
  1. mutable e_desc : e_desc;
  2. mutable e_typ : Types.typ;
}
and e_desc =
  1. | EInt of int
  2. | EFloat of float
  3. | EChar of char
  4. | EBool of bool
  5. | EEnum of string
  6. | EVar of string
  7. | EBinop of string * t * t
    (*

    e1 op e2

    *)
  8. | ECond of t * t * t
    (*

    e1 ? e2 : e3

    *)
  9. | EFapp of string * t list
    (*

    f(arg1,...,argn)

    *)
  10. | EArrExt of t list
    (*

    e1,...,e2

    *)
  11. | EArr of string * t
    (*

    ti when t is an array

    *)
  12. | EBit of string * t
    (*

    ti when t is an int

    *)
  13. | EBitrange of string * t * t
    (*

    thi:lo when t is an int

    *)
  14. | ERecord of string * string
    (*

    v.name when v is a record

    *)
  15. | ECast of t * Type_expr.t
type value = {
  1. mutable v_desc : e_val;
  2. mutable v_typ : Types.typ;
}
and e_val =
  1. | Val_int of int
  2. | Val_float of float
  3. | Val_char of char
  4. | Val_bool of bool
  5. | Val_enum of string
  6. | Val_fn of string list * t
    (*

    args, body

    *)
  7. | Val_unknown
  8. | Val_none
    (*

    used for pure events

    *)
  9. | Val_array of value array
  10. | Val_record of (string * value) list
    (*

    (Field name, value) list

    *)
exception Out_of_bound of string * int

array name, index value

Builders

val mk_expr : e_desc -> t
val mk_var : string -> t
val mk_val : Types.typ -> e_val -> value
val mk_array : value list -> value
val mk_record : Types.name -> (string * Types.typ * value) list -> value
val mk_int : int -> value
val mk_float : float -> value
val mk_char : char -> value
val mk_bool : bool -> value
val array_update : string -> value array -> int -> value -> value array
val record_update : string -> (string * value) list -> string -> value -> (string * value) list
val unset_event : value
val set_event : value

Accessors

val of_value : value -> e_desc
module VarSet : Set.S with type elt = string
val vars_of : t -> VarSet.t

Manipulators

val rename : (string -> string) -> t -> t

Printers

val string_of_expr : e_desc -> string
val string_of_typed_expr : t -> string
val to_string : t -> string
val string_of_val : e_val -> string
val string_of_value : value -> string
val string_of_opt_value : value option -> string
OCaml

Innovation. Community. Security.