package bap-core-theory

  1. Overview
  2. Docs

Variables.

Variables give names to values, read the Variables section for more information.

type 'a t
type ident
val bin_shape_ident : Core_kernel.Bin_prot.Shape.t
val __bin_read_ident__ : (int -> ident) Core_kernel.Bin_prot.Read.reader
val compare_ident : ident -> ident -> int
val sexp_of_ident : ident -> Ppx_sexp_conv_lib.Sexp.t
val ident_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> ident
type ord
val define : 'a Value.sort -> string -> 'a t

define sort name a global variable with name and sort.

val create : 'a Value.sort -> ident -> 'a t

create s id a variable with sort s and identifier id.

The identifier encodes what kind of variable is created. This function is usually created by parsers, that parse a well-formed programs.

val forget : 'a t -> unit t

forget v forgets the type index describing the sort of the variable.

val resort : 'a t -> 'b Value.sort -> 'b t

resort v changes the sort of the variable.

val versioned : 'a t -> int -> 'a t

versioned v n creates the nth version of the variable v.

Variable versions could be used to represent the same variable under different context or to ensure some normalization of the program, e.g., SSA.

val version : 'a t -> int

version v is the version of the variable v.

Variable versions could be used to represent the same variable under different context or to ensure some normalization of the program, e.g., SSA.

val ident : 'a t -> ident

ident v is variable's identifier.

val name : 'a t -> string

name v is variable's name

val sort : 'a t -> 'a Value.sort

sort v is variable's sort.

val is_virtual : 'a t -> bool

is_virtual v is true if v is virtual.

Virtual variables do not have any physical representation.

val is_mutable : 'a t -> bool

is_mutable v is true if v is mutable.

Only scoped variables are immutable.

val fresh : 'a Value.sort -> 'a t Bap_knowledge.knowledge

fresh s creates a fresh virtual mutable variable of sort s.

val scoped : 'a Value.sort -> ('a t -> 'b pure) -> 'b pure

scoped s creates a fresh immutable variable of sort s.

module Ident : sig ... end

Variable identifiers.

module Top : sig ... end

Variables with erased sort index.