package fsml

  1. Overview
  2. Docs

Simple (int) expressions for FSMs

type ident = string

The type of identifiers occuring in expressions

val pp_ident : Ppx_deriving_runtime.Format.formatter -> ident -> Ppx_deriving_runtime.unit
val show_ident : ident -> Ppx_deriving_runtime.string
val ident_to_yojson : ident -> Yojson.Safe.t
type t = {
  1. e_desc : e_desc;
  2. mutable e_typ : Types.t;
}
and e_desc =
  1. | EInt of int
  2. | EBool of bool
  3. | EVar of ident
  4. | EBinop of string * t * t
val pp : Ppx_deriving_runtime.Format.formatter -> t -> Ppx_deriving_runtime.unit
val show : t -> Ppx_deriving_runtime.string
val pp_e_desc : Ppx_deriving_runtime.Format.formatter -> e_desc -> Ppx_deriving_runtime.unit
val show_e_desc : e_desc -> Ppx_deriving_runtime.string
val to_yojson : t -> Yojson.Safe.t
val e_desc_to_yojson : e_desc -> Yojson.Safe.t
type value = {
  1. mutable v_desc : e_val;
  2. mutable v_typ : Types.t;
}
and e_val =
  1. | Int of int
  2. | Bool of bool
  3. | Prim of e_val list -> e_val
  4. | Unknown
  5. | Enum of string
    (*

    This is a hack to allow tracing of state transitions

    *)
val pp_value : Ppx_deriving_runtime.Format.formatter -> value -> Ppx_deriving_runtime.unit
val show_value : value -> Ppx_deriving_runtime.string
val pp_e_val : Ppx_deriving_runtime.Format.formatter -> e_val -> Ppx_deriving_runtime.unit
val show_e_val : e_val -> Ppx_deriving_runtime.string
val of_value : e_val -> t
val is_const : t -> bool
val is_var_test : string -> t -> bool

Builders

val mk_bool_expr : e_desc -> t
val mk_int_expr : e_desc -> t

Evaluation

type env = (ident * e_val) list

Evaluation environment

val pp_env : Ppx_deriving_runtime.Format.formatter -> env -> Ppx_deriving_runtime.unit
val show_env : env -> Ppx_deriving_runtime.string

Printing

val to_string : t -> string
val string_of_value : e_val -> string

Simulation

val lookup_env : env -> ident -> e_val
val update_env : env -> (ident * e_val) -> env
exception Unbound_id of ident
exception Unknown_id of ident
exception Illegal_expr of t
exception Illegal_value of e_val
val eval : env -> t -> e_val
val bool_val : e_val -> bool
val int_val : e_val -> int
OCaml

Innovation. Community. Security.