package mopsa
Install
Dune Dependency
Authors
Maintainers
Sources
md5=fdee20e988343751de440b4f6b67c0f4
sha512=f5cbf1328785d3f5ce40155dada2d95e5de5cce4f084ea30cfb04d1ab10cc9403a26cfb3fa55d0f9da72244482130fdb89c286a9aed0d640bba46b7c00e09500
doc/lang/Lang/Ast/index.html
Module Lang.Ast
Source
Abstract Syntax Tree extension for the simple Universal language.
Universal types
type Mopsa.typ +=
| T_int
(*Mathematical integers with arbitrary precision.
*)| T_float of float_prec
(*Floating-point real numbers.
*)| T_string
(*Strings.
*)| T_array of Mopsa.typ
(*Array of
*)typ
| T_unit
(*Unit type
*)| T_char
Universal constants
type Mopsa.constant +=
| C_unit
| C_int of Z.t
(*Integer numbers, with arbitrary precision.
*)| C_float of float
(*Floating-point numbers.
*)| C_string of string
(*String constants.
*)| C_int_interval of Mopsa.ItvUtils.IntBound.t * Mopsa.ItvUtils.IntBound.t
(*Integer ranges.
*)| C_float_interval of float * float
(*Float ranges.
*)
Constants.
Universal operators
type Mopsa.operator +=
| O_sqrt
(*square root
*)| O_abs
(*absolute value
*)| O_bit_invert
(*bitwise ~
*)| O_wrap of Z.t * Z.t
(*wrap
*)| O_filter_float_class of float_class
(*filter float by class
*)| O_plus
(*| O_minus
(*| O_mult
(**
*)| O_div
(*/
*)| O_mod
(*% where the remainder can be negative, following C
*)| O_ediv
(*euclidian division
*)| O_erem
(*remainder for euclidian division
*)| O_pow
(*power
*)| O_bit_and
(*&
*)| O_bit_or
(*|
*)| O_bit_xor
(*^
*)| O_bit_rshift
(*>>
*)| O_bit_lshift
(*<<
*)| O_concat
(*concatenation of arrays and strings
*)| O_convex_join
(*convex join of arithmetic expressions
*)| O_float_class of float_class
Universal functions
type fundec = {
fun_orig_name : string;
(*original name of the function
*)fun_uniq_name : string;
(*unique name of the function
*)fun_range : Mopsa.range;
(*function range
*)fun_parameters : Mopsa.var list;
(*list of parameters
*)fun_locvars : Mopsa.var list;
(*list of local variables
*)mutable fun_body : Mopsa.stmt;
(*body of the function
*)fun_return_type : Mopsa.typ option;
(*return type
*)fun_return_var : Mopsa.var option;
(*variable storing the return value
*)
}
Function definition
Universal program
type u_program = {
universal_gvars : Mopsa.var list;
universal_fundecs : fundec list;
universal_main : Mopsa.stmt;
}
module UProgramKey : sig ... end
Flow-insensitive context to keep the analyzed C program
Set the C program in the flow
Get the C program from the flow
Universal expressions
type Mopsa.expr_kind +=
| E_function of fun_expr
| E_call of Mopsa.expr * Mopsa.expr list
(*List of arguments
*)| E_array of Mopsa.expr list
| E_subscript of Mopsa.expr * Mopsa.expr
| E_len of Mopsa.expr
Universal statements
type Mopsa.stmt_kind +=
| S_expression of Mopsa.expr
(*Expression statement, useful for calling functions without a return value
*)| S_if of Mopsa.expr * Mopsa.stmt * Mopsa.stmt
(*else branch
*)| S_return of Mopsa.expr option
(*Function return with an optional return expression
*)| S_while of Mopsa.expr * Mopsa.stmt
(*loop body
*)| S_break
(*Loop break
*)| S_continue
(*Loop continue
*)| S_unit_tests of (string * Mopsa.stmt) list
(*list of unit tests and their names
*)| S_assert of Mopsa.expr
(*Unit tests assertions
*)| S_satisfy of Mopsa.expr
(*Unit tests satisfiability check
*)| S_print_state
(*Print the abstract flow map at current location
*)| S_print_expr of Mopsa.expr list
(*Pretty print the values of expressions
*)| S_free of Mopsa.addr
(*Release a heap address
*)
Utility functions
val mk_int_interval :
int ->
int ->
?typ:Mopsa.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val mk_int_general_interval :
Mopsa.ItvUtils.IntBound.t ->
Mopsa.ItvUtils.IntBound.t ->
?typ:Mopsa.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val mk_float_interval :
?prec:float_prec ->
float ->
float ->
Mopsa_utils.Location.range ->
Mopsa.expr
val mk_in :
?strict:bool ->
?left_strict:bool ->
?right_strict:bool ->
?etyp:Mopsa.typ ->
Mopsa.expr ->
Mopsa.expr ->
Mopsa.expr ->
Mopsa_utils.Location.range ->
Mopsa.expr
val add :
Mopsa.expr ->
Mopsa.expr ->
?typ:Ast.Typ.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val sub :
Mopsa.expr ->
Mopsa.expr ->
?typ:Ast.Typ.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val mul :
Mopsa.expr ->
Mopsa.expr ->
?typ:Ast.Typ.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val div :
Mopsa.expr ->
Mopsa.expr ->
?typ:Ast.Typ.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val ediv :
Mopsa.expr ->
Mopsa.expr ->
?typ:Ast.Typ.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val _mod_ :
Mopsa.expr ->
Mopsa.expr ->
?typ:Ast.Typ.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val erem :
Mopsa.expr ->
Mopsa.expr ->
?typ:Ast.Typ.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val eq :
Mopsa.expr ->
Mopsa.expr ->
?etyp:Mopsa.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val ne :
Mopsa.expr ->
Mopsa.expr ->
?etyp:Mopsa.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val lt :
Mopsa.expr ->
Mopsa.expr ->
?etyp:Mopsa.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val le :
Mopsa.expr ->
Mopsa.expr ->
?etyp:Mopsa.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val gt :
Mopsa.expr ->
Mopsa.expr ->
?etyp:Mopsa.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val ge :
Mopsa.expr ->
Mopsa.expr ->
?etyp:Mopsa.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val mk_eq :
Mopsa.expr ->
Mopsa.expr ->
?etyp:Mopsa.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val mk_ne :
Mopsa.expr ->
Mopsa.expr ->
?etyp:Mopsa.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val mk_lt :
Mopsa.expr ->
Mopsa.expr ->
?etyp:Mopsa.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val mk_le :
Mopsa.expr ->
Mopsa.expr ->
?etyp:Mopsa.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val mk_gt :
Mopsa.expr ->
Mopsa.expr ->
?etyp:Mopsa.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val mk_ge :
Mopsa.expr ->
Mopsa.expr ->
?etyp:Mopsa.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val log_or :
Mopsa.expr ->
Mopsa.expr ->
?etyp:Mopsa.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val log_and :
Mopsa.expr ->
Mopsa.expr ->
?etyp:Mopsa.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val log_xor :
Mopsa.expr ->
Mopsa.expr ->
?etyp:Mopsa.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val mk_log_or :
Mopsa.expr ->
Mopsa.expr ->
?etyp:Mopsa.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val mk_log_and :
Mopsa.expr ->
Mopsa.expr ->
?etyp:Mopsa.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val mk_log_xor :
Mopsa.expr ->
Mopsa.expr ->
?etyp:Mopsa.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val mk_filter_float_class :
float_class ->
Mopsa.expr ->
Mopsa_utils.Location.range ->
Mopsa.expr
val mk_block :
Mopsa.stmt list ->
?vars:Ast.Var.var list ->
Mopsa_utils.Location.range ->
Mopsa.stmt
val mk_if :
Mopsa.expr ->
Mopsa.stmt ->
Mopsa.stmt ->
Mopsa_utils.Location.range ->
Mopsa.stmt
val mk_rename_addr :
Ast.Addr.addr ->
Ast.Addr.addr ->
Mopsa_utils.Location.range ->
Mopsa.stmt
val mk_expand_addr :
Ast.Addr.addr ->
Ast.Addr.addr list ->
Mopsa_utils.Location.range ->
Mopsa.stmt
val mk_fold_addr :
Ast.Addr.addr ->
Ast.Addr.addr list ->
Mopsa_utils.Location.range ->
Mopsa.stmt