package mopsa
Module Stubs.Ast
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 : MopsaLib.var list;stub_func_locals : local MopsaLib.with_range list;stub_func_assigns : assigns MopsaLib.with_range list;stub_func_return_type : MopsaLib.typ option;stub_func_range : MopsaLib.range;
}Stub for a function
and stub_directive = {stub_directive_body : section list;stub_directive_locals : local MopsaLib.with_range list;stub_directive_assigns : assigns MopsaLib.with_range list;stub_directive_range : MopsaLib.range;
}Stub for a global directive
Stub sections
*****************
and leaf = | S_local of local MopsaLib.with_range| S_assumes of assumes MopsaLib.with_range| S_requires of requires MopsaLib.with_range| S_assigns of assigns MopsaLib.with_range| S_ensures of ensures MopsaLib.with_range| S_free of free MopsaLib.with_range| S_message of message MopsaLib.with_range
and case = {case_label : string;case_body : leaf list;case_locals : local MopsaLib.with_range list;case_assigns : assigns MopsaLib.with_range list;case_range : MopsaLib.range;
}Leaf sections
*****************
and requires = formula MopsaLib.with_rangeand ensures = formula MopsaLib.with_rangeand assumes = formula MopsaLib.with_rangeand free = MopsaLib.exprand interval = MopsaLib.expr * MopsaLib.exprand resource = Mopsa_c_stubs_parser.Ast.resourceand builtin = Mopsa_c_stubs_parser.Ast.builtinFormulas
************
and formula = | F_expr of MopsaLib.expr| F_binop of log_binop * formula MopsaLib.with_range * formula MopsaLib.with_range| F_not of formula MopsaLib.with_range| F_forall of MopsaLib.var * set * formula MopsaLib.with_range| F_exists of MopsaLib.var * set * formula MopsaLib.with_range| F_in of MopsaLib.expr * set| F_otherwise of formula MopsaLib.with_range * MopsaLib.expr| F_if of formula MopsaLib.with_range * formula MopsaLib.with_range * formula MopsaLib.with_range
val compare_formula :
formula MopsaLib.with_range ->
formula MopsaLib.with_range ->
intExpressions
type MopsaLib.expr_kind += | E_stub_call of stub_func * MopsaLib.expr list(*arguments
*)| E_stub_return(*Returned value of a stub
*)| E_stub_builtin_call of builtin * MopsaLib.expr list(*Call to a built-in function
*)| E_stub_attribute of MopsaLib.expr * string(*Access to an attribute of a resource
*)| E_stub_alloc of string * MopsaLib.mode(*strong or weak
*)| E_stub_resource_mem of MopsaLib.expr * resource(*Filter environments in which an instance is in a resource pool
*)| E_stub_primed of MopsaLib.expr(*Primed expressions denoting values in the post-state
*)| E_stub_quantified_formula of (quant * MopsaLib.var * set) list * MopsaLib.expr(*Quantifier-free formula
*)| E_stub_otherwise of MopsaLib.expr * MopsaLib.expr option(*alarm
*)| E_stub_raise of string(*message
*)| E_stub_if of MopsaLib.expr * MopsaLib.expr * MopsaLib.expr(*else
*)
Conditional stub expression
Statements
type MopsaLib.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 MopsaLib.expr(*Release a resource
*)| S_stub_requires of MopsaLib.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
********************************
val opt_stub_resource_allocation_policy : string refUtility functions
*********************
val mk_stub_call :
stub_func ->
MopsaLib.expr list ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval mk_stub_builtin_call :
builtin ->
MopsaLib.expr list ->
etyp:Framework.Core.Ast.Typ.typ ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval mk_stub_resource_mem :
MopsaLib.expr ->
resource ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval mk_stub_primed :
MopsaLib.expr ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval mk_stub_directive :
stub_directive ->
Mopsa_utils.Core.Location.range ->
MopsaLib.stmtval mk_stub_free :
MopsaLib.expr ->
Mopsa_utils.Core.Location.range ->
MopsaLib.stmtval mk_stub_prepare_all_assigns :
assigns MopsaLib.with_range list ->
Mopsa_utils.Core.Location.range ->
MopsaLib.stmtval mk_stub_assigns :
MopsaLib.expr ->
interval list ->
Mopsa_utils.Core.Location.range ->
MopsaLib.stmtval mk_stub_clean_all_assigns :
assigns MopsaLib.with_range list ->
Mopsa_utils.Core.Location.range ->
MopsaLib.stmtval mk_stub_requires :
MopsaLib.expr ->
Mopsa_utils.Core.Location.range ->
MopsaLib.stmtval mk_stub_quantified_formula :
?etyp:??? ->
(quant * MopsaLib.var * set) list ->
MopsaLib.expr ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval mk_stub_otherwise :
MopsaLib.expr ->
MopsaLib.expr option ->
?etyp:??? ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval mk_stub_if :
MopsaLib.expr ->
MopsaLib.expr ->
MopsaLib.expr ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval is_stub_primed : Framework.Core.Ast.Expr.expr -> boolval find_var_quantifier :
MopsaLib.var ->
('a * MopsaLib.var * 'b) list ->
'a * 'bval find_var_quantifier_opt :
MopsaLib.var ->
('a * MopsaLib.var * 'b) list ->
('a * 'b) optionval is_quantified_var : MopsaLib.var -> ('a * MopsaLib.var * 'b) list -> boolval is_forall_quantified_var :
MopsaLib.var ->
(quant * MopsaLib.var * 'a) list ->
boolval is_exists_quantified_var :
MopsaLib.var ->
(quant * MopsaLib.var * 'a) list ->
boolval find_quantified_var_interval :
MopsaLib.var ->
('a * MopsaLib.var * set) list ->
MopsaLib.expr * MopsaLib.exprval find_quantified_var_interval_opt :
MopsaLib.var ->
('a * MopsaLib.var * set) list ->
(MopsaLib.expr * MopsaLib.expr) optionval negate_stub_quantified_formula :
(quant * 'a * 'b) list ->
MopsaLib.expr ->
(quant * 'a * 'b) list * MopsaLib.exprval visit_expr_in_formula :
(Framework.Core.Ast.Expr.expr ->
Framework.Core.Ast.Expr.expr Mopsa_analyzer.MopsaLib.Visitor.visit_action) ->
formula MopsaLib.with_range ->
formula MopsaLib.with_rangeVisit expressions present in a formula
val visit_set :
(Framework.Core.Ast.Expr.expr ->
Framework.Core.Ast.Expr.expr Mopsa_analyzer.MopsaLib.Visitor.visit_action) ->
set ->
setval visit_expr :
(Framework.Core.Ast.Expr.expr ->
Framework.Core.Ast.Expr.expr Mopsa_analyzer.MopsaLib.Visitor.visit_action) ->
MopsaLib.expr ->
MopsaLib.exprval exprs_in_formula : formula MopsaLib.with_range -> MopsaLib.expr listval exprs_in_set : set -> MopsaLib.expr listval exprs_in_local : local -> MopsaLib.expr listval exprs_in_assigns : assigns -> MopsaLib.expr listval exprs_in_leaf : leaf -> MopsaLib.expr listval exprs_in_case : case -> MopsaLib.expr listval exprs_in_section : section -> MopsaLib.expr listval exprs_in_stub_func : stub_func -> MopsaLib.expr listval exprs_in_stub_directive : stub_directive -> MopsaLib.expr listval mk_stub_alloc_resource :
?mode:??? ->
string ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprPretty printers
=-=-=-=-=-=-=-=-=-=
val pp_builtin : Format.formatter -> Parsing.Cst.builtin -> unitval pp_log_binop :
Format.formatter ->
Mopsa_c_stubs_parser.Ast.log_binop ->
unitval pp_quantifier : Format.formatter -> quant -> unitval pp_formula : Format.formatter -> formula MopsaLib.with_range -> unitval pp_set : Format.formatter -> set -> unitval pp_interval : Format.formatter -> interval -> unitval pp_resource : Format.formatter -> resource -> unitval pp_list :
(Format.formatter -> 'a -> unit) ->
(unit, Format.formatter, unit) format ->
Format.formatter ->
'a list ->
unitval pp_local : Format.formatter -> local MopsaLib.with_range -> unitval pp_local_value : Format.formatter -> local_value -> unitval pp_requires :
Format.formatter ->
formula MopsaLib.with_range MopsaLib.with_range ->
unitval pp_assigns : Format.formatter -> assigns MopsaLib.with_range -> unitval pp_assumes : Format.formatter -> assumes MopsaLib.with_range -> unitval pp_ensures :
Format.formatter ->
formula MopsaLib.with_range MopsaLib.with_range ->
unitval pp_free : Format.formatter -> MopsaLib.expr MopsaLib.with_range -> unitval pp_message : Format.formatter -> message MopsaLib.with_range -> unitval pp_leaf_section : Format.formatter -> leaf -> unitval pp_leaf_sections : Format.formatter -> leaf list -> unitval pp_case : Format.formatter -> case -> unitval pp_section : Format.formatter -> section -> unitval pp_sections : Format.formatter -> section list -> unitval pp_stub_func : Format.formatter -> stub_func -> unitval pp_stub_directive : Format.formatter -> stub_directive -> unit