package mopsa
Install
Dune Dependency
Authors
Maintainers
Sources
md5=fdee20e988343751de440b4f6b67c0f4
sha512=f5cbf1328785d3f5ce40155dada2d95e5de5cce4f084ea30cfb04d1ab10cc9403a26cfb3fa55d0f9da72244482130fdb89c286a9aed0d640bba46b7c00e09500
doc/stubs/Stubs/Ast/index.html
Module Stubs.Ast
Source
Abstract Syntax Tree for stub specification. Similar to the AST of the parser, except for expressions, types and variables for which MOPSA counterparts are used.
type stub_func = {
stub_func_name : string;
stub_func_body : section list;
stub_func_params : Mopsa.var list;
stub_func_locals : local Mopsa.with_range list;
stub_func_assigns : assigns Mopsa.with_range list;
stub_func_return_type : Mopsa.typ option;
stub_func_range : Mopsa.range;
}
Stub for a function
and stub_directive = {
stub_directive_body : section list;
stub_directive_locals : local Mopsa.with_range list;
stub_directive_assigns : assigns Mopsa.with_range list;
stub_directive_range : Mopsa.range;
}
Stub for a global directive
Stub sections
*****************
and leaf =
| S_local of local Mopsa.with_range
| S_assumes of assumes Mopsa.with_range
| S_requires of requires Mopsa.with_range
| S_assigns of assigns Mopsa.with_range
| S_ensures of ensures Mopsa.with_range
| S_free of free Mopsa.with_range
| S_message of message Mopsa.with_range
and case = {
case_label : string;
case_body : leaf list;
case_locals : local Mopsa.with_range list;
case_assigns : assigns Mopsa.with_range list;
case_range : Mopsa.range;
}
Leaf sections
*****************
Formulas
************
and formula =
| F_expr of Mopsa.expr
| F_binop of log_binop * formula Mopsa.with_range * formula Mopsa.with_range
| F_not of formula Mopsa.with_range
| F_forall of Mopsa.var * set * formula Mopsa.with_range
| F_exists of Mopsa.var * set * formula Mopsa.with_range
| F_in of Mopsa.expr * set
| F_otherwise of formula Mopsa.with_range * Mopsa.expr
| F_if of formula Mopsa.with_range * formula Mopsa.with_range * formula Mopsa.with_range
Expressions
Quantifiers
type Mopsa.expr_kind +=
| E_stub_call of stub_func * Mopsa.expr list
(*arguments
*)| E_stub_return
(*Returned value of a stub
*)| E_stub_builtin_call of builtin * Mopsa.expr list
(*Call to a built-in function
*)| E_stub_attribute of Mopsa.expr * string
(*Access to an attribute of a resource
*)| E_stub_alloc of string * Mopsa.mode
(*strong or weak
*)| E_stub_resource_mem of Mopsa.expr * resource
(*Filter environments in which an instance is in a resource pool
*)| E_stub_primed of Mopsa.expr
(*Primed expressions denoting values in the post-state
*)| E_stub_quantified_formula of (quant * Mopsa.var * set) list * Mopsa.expr
(*Quantifier-free formula
*)| E_stub_otherwise of Mopsa.expr * Mopsa.expr option
(*alarm
*)| E_stub_raise of string
(*message
*)| E_stub_if of Mopsa.expr * Mopsa.expr * Mopsa.expr
(*else
*)
Conditional stub expression
Statements
type Mopsa.stmt_kind +=
| S_stub_directive of stub_directive
(*A call to a stub directive, which are stub functions called at the initialization of the analysis. Useful to initialize variables with stub formulas.
*)| S_stub_free of Mopsa.expr
(*Release a resource
*)| S_stub_requires of Mopsa.expr
(*Filter the current environments that verify a condition, and raise an alarm if the condition may be violated.
*)| S_stub_prepare_all_assigns of assigns list
(*Prepare primed copies of assigned objects
*)| S_stub_assigns of assigns
(*Declare an assigned object
*)| S_stub_clean_all_assigns of assigns list
(*Clean the post-state of primed copies
*)
Heap addresses for resources
********************************
Utility functions
*********************
val mk_stub_builtin_call :
builtin ->
Mopsa.expr list ->
etyp:Ast.Typ.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val mk_stub_prepare_all_assigns :
assigns Mopsa.with_range list ->
Mopsa_utils.Location.range ->
Mopsa.stmt
val mk_stub_clean_all_assigns :
assigns Mopsa.with_range list ->
Mopsa_utils.Location.range ->
Mopsa.stmt
val mk_stub_quantified_formula :
?etyp:Mopsa.typ ->
(quant * Mopsa.var * set) list ->
Mopsa.expr ->
Mopsa_utils.Location.range ->
Mopsa.expr
val mk_stub_otherwise :
Mopsa.expr ->
Mopsa.expr option ->
?etyp:Mopsa.typ ->
Mopsa_utils.Location.range ->
Mopsa.expr
val mk_stub_if :
Mopsa.expr ->
Mopsa.expr ->
Mopsa.expr ->
Mopsa_utils.Location.range ->
Mopsa.expr
val find_quantified_var_interval :
Mopsa.var ->
('a * Mopsa.var * set) list ->
Mopsa.expr * Mopsa.expr
val find_quantified_var_interval_opt :
Mopsa.var ->
('a * Mopsa.var * set) list ->
(Mopsa.expr * Mopsa.expr) option
val negate_stub_quantified_formula :
(quant * 'a * 'b) list ->
Mopsa.expr ->
(quant * 'a * 'b) list * Mopsa.expr
val visit_expr_in_formula :
(Ast.Expr.expr -> Ast.Expr.expr Mopsa.Visitor.visit_action) ->
formula Mopsa.with_range ->
formula Mopsa.with_range
Visit expressions present in a formula
val visit_expr :
(Ast.Expr.expr -> Ast.Expr.expr Mopsa.Visitor.visit_action) ->
Mopsa.expr ->
Mopsa.expr
val mk_stub_alloc_resource :
?mode:Mopsa.mode ->
string ->
Mopsa_utils.Location.range ->
Mopsa.expr
Pretty printers
=-=-=-=-=-=-=-=-=-=
val pp_list :
(Stdlib.Format.formatter -> 'a -> unit) ->
(unit, Stdlib.Format.formatter, unit) Stdlib.format ->
Stdlib.Format.formatter ->
'a list ->
unit
val pp_requires :
Stdlib.Format.formatter ->
formula Mopsa.with_range Mopsa.with_range ->
unit