package fsml

  1. Overview
  2. Docs

Module Fsml.ExprSource

Simple (int) expressions for FSMs

Sourcetype ident = string

The type of identifiers occuring in expressions

Sourceval ident_to_yojson : ident -> Yojson.Safe.t
Sourcetype t = {
  1. e_desc : e_desc;
  2. mutable e_typ : Types.t;
}
Sourceand e_desc =
  1. | EInt of int
  2. | EBool of bool
  3. | EVar of ident
  4. | EBinop of string * t * t
Sourceval to_yojson : t -> Yojson.Safe.t
Sourceval e_desc_to_yojson : e_desc -> Yojson.Safe.t
Sourcetype value = {
  1. mutable v_desc : e_val;
  2. mutable v_typ : Types.t;
}
Sourceand 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

    *)
Sourceval of_value : e_val -> t
Sourceval is_const : t -> bool
Sourceval is_var_test : string -> t -> bool

Builders

Sourceval mk_bool_expr : e_desc -> t
Sourceval mk_int_expr : e_desc -> t

Evaluation

Sourcetype env = (ident * e_val) list

Evaluation environment

Printing

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

Simulation

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

Innovation. Community. Security.