package mopsa
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=37966e98ffeebcedc09bd6e9b2b81f69
sha512=40d4d826c25f680766c07eccbabdf5e8a4fa023016e8a164e4e4f6b3781c8484dc4df437055721dfd19b9db8fb7fe3b61236c4833186d346fc7204a68d01eaaa
doc/mopsa.mopsa_analyzer/Mopsa_analyzer/Languages/Python/Lang/Ast/index.html
Module Lang.Ast
Python AST
Constants
Types
type py_type = | Bool| NotImplemented| Complex| NoneType| Bytes| Str| Int| Float of Universal.Lang.Ast.float_prec
Python-specific types
val is_py_exp : MopsaLib.expr -> boolExpressions
type py_object = MopsaLib.addr * MopsaLib.expr optionPython objects
optional value representation
type MopsaLib.operator += val is_arith_op : MopsaLib.operator -> boolval is_comp_op : MopsaLib.operator -> booltype py_lambda = {py_lambda_body : MopsaLib.expr;(*Body.
*)py_lambda_parameters : MopsaLib.var list;(*list of parameters variables
*)py_lambda_defaults : MopsaLib.expr option list;(*list of default parameters values
*)
}Lambda functions.
type MopsaLib.expr_kind += | E_py_undefined of bool| E_py_object of py_object| E_py_list of MopsaLib.expr list| E_py_index_subscript of MopsaLib.expr * MopsaLib.expr(*index
*)| E_py_slice_subscript of MopsaLib.expr * MopsaLib.expr * MopsaLib.expr * MopsaLib.expr(*step
*)| E_py_attribute of MopsaLib.expr * string(*attribute name
*)| E_py_dict of MopsaLib.expr list * MopsaLib.expr list(*values
*)| E_py_set of MopsaLib.expr list| E_py_generator_comprehension of MopsaLib.expr * (MopsaLib.expr * MopsaLib.expr * MopsaLib.expr list) list(*list of comprehensions
*)| E_py_list_comprehension of MopsaLib.expr * (MopsaLib.expr * MopsaLib.expr * MopsaLib.expr list) list(*list of comprehensions
*)| E_py_set_comprehension of MopsaLib.expr * (MopsaLib.expr * MopsaLib.expr * MopsaLib.expr list) list(*list of comprehensions
*)| E_py_dict_comprehension of MopsaLib.expr * MopsaLib.expr * (MopsaLib.expr * MopsaLib.expr * MopsaLib.expr list) list(*list of comprehensions
*)| E_py_call of MopsaLib.expr * MopsaLib.expr list * (string option * MopsaLib.expr) list(*keywords (None id for **kwargs)
*)| E_py_yield of MopsaLib.expr| E_py_yield_from of MopsaLib.expr| E_py_if of MopsaLib.expr * MopsaLib.expr * MopsaLib.expr(*orelse
*)| E_py_tuple of MopsaLib.expr list| E_py_bytes of string| E_py_lambda of py_lambda| E_py_multi_compare of MopsaLib.expr * MopsaLib.operator list * MopsaLib.expr list| E_py_annot of MopsaLib.expr| E_py_check_annot of MopsaLib.expr * MopsaLib.expr(*low-level hasattribute working at the object level only
*)| E_py_ll_hasattr of MopsaLib.expr * MopsaLib.expr(*attribute name
*)| E_py_ll_getattr of MopsaLib.expr * MopsaLib.expr(*attribute name
*)| E_py_ll_setattr of MopsaLib.expr * MopsaLib.expr * MopsaLib.expr option
Statements
type py_fundec = {py_func_var : MopsaLib.var;(*function object variable
*)py_func_parameters : MopsaLib.var list;(*list of parameters variables
*)py_func_defaults : MopsaLib.expr option list;(*list of default parameters values
*)py_func_vararg : MopsaLib.var option;py_func_kwonly_args : MopsaLib.var list;py_func_kwonly_defaults : MopsaLib.expr option list;py_func_kwarg : MopsaLib.var option;py_func_locals : MopsaLib.var list;(*list of local variables
*)py_func_body : MopsaLib.stmt;(*function body
*)py_func_is_generator : bool;(*is the function a generator?
*)py_func_decors : MopsaLib.expr list;py_func_types_in : MopsaLib.expr option list;py_func_type_out : MopsaLib.expr option;py_func_range : MopsaLib.range;(*range of the function
*)py_func_ret_var : MopsaLib.var;py_func_cellvars : MopsaLib.var list;py_func_freevars : MopsaLib.var list;
}Python function descriptor
type py_func_sig = {py_funcs_parameters : MopsaLib.var list;py_funcs_defaults : bool list;py_funcs_exceptions : MopsaLib.expr list;py_funcs_types_in : MopsaLib.expr option list;py_funcs_type_out : MopsaLib.expr option;
}type py_func_annot = {py_funca_var : MopsaLib.var;py_funca_decors : MopsaLib.expr list;py_funca_range : MopsaLib.range;py_funca_ret_var : MopsaLib.var;py_funca_sig : py_func_sig list;
}val pp_py_func_sig : Format.formatter -> py_func_sig -> unitval compare_py_func_sig : py_func_sig -> py_func_sig -> intval pp_py_func_annot : Format.formatter -> py_func_annot -> unittype py_clsdec = {py_cls_var : MopsaLib.var;(*class object variable
*)py_cls_body : MopsaLib.stmt;py_cls_static_attributes : MopsaLib.var list;(*list of declared attributes: static variables and methods
*)py_cls_bases : MopsaLib.expr list;(*base classes
*)py_cls_decors : MopsaLib.expr list;py_cls_keywords : (string option * MopsaLib.expr) list;(*keywords (None id for **kwargs)
*)py_cls_range : MopsaLib.range;(*range of the class
*)
}A Python class
type py_cls_annot = {py_cls_a_var : MopsaLib.var;py_cls_a_body : MopsaLib.stmt;py_cls_a_bases : MopsaLib.expr list;py_cls_a_abases : MopsaLib.expr list;py_cls_a_static_attributes : MopsaLib.var list;py_cls_a_range : MopsaLib.range;
}type py_excpt = {py_excpt_type : MopsaLib.expr option;(*exception class. None is used for the default except
*)py_excpt_name : MopsaLib.var option;(*optional name of exception instance
*)py_excpt_body : MopsaLib.stmt;(*body of the except handler
*)
}Exception handler
type MopsaLib.stmt_kind += | S_py_class of py_clsdec| S_py_function of py_fundec| S_py_try of MopsaLib.stmt * py_excpt list * MopsaLib.stmt * MopsaLib.stmt(*final body
*)| S_py_raise of MopsaLib.expr option| S_py_if of MopsaLib.expr * MopsaLib.stmt * MopsaLib.stmt| S_py_while of MopsaLib.expr * MopsaLib.stmt * MopsaLib.stmt| S_py_multi_assign of MopsaLib.expr list * MopsaLib.expr| S_py_aug_assign of MopsaLib.expr * MopsaLib.operator * MopsaLib.expr| S_py_annot of MopsaLib.expr * MopsaLib.expr| S_py_check_annot of MopsaLib.expr * MopsaLib.expr| S_py_for of MopsaLib.expr * MopsaLib.expr * MopsaLib.stmt * MopsaLib.stmt(*else
*)| S_py_import of string * MopsaLib.var option * MopsaLib.var(*root module
*)| S_py_import_from of string * string * MopsaLib.var * MopsaLib.var(*module var
*)| S_py_delete of MopsaLib.expr| S_py_assert of MopsaLib.expr * MopsaLib.expr option(*message
*)| S_py_with of MopsaLib.expr * MopsaLib.expr option * MopsaLib.stmt(*body
*)
Statements
Programs
module K : sig ... endFlow-insensitive context to keep the analyzed C program
val py_program_ctx :
('a, string * MopsaLib.var list * MopsaLib.stmt)
Mopsa_analyzer__Framework__Core__Context.ctx_keyval set_py_program :
(string * MopsaLib.var list * MopsaLib.stmt) ->
'a Mopsa_analyzer.MopsaLib.Flow.flow ->
'a Mopsa_analyzer.MopsaLib.Flow.flowSet the Python program in the flow
val get_py_program :
'a Mopsa_analyzer.MopsaLib.Flow.flow ->
string * MopsaLib.var list * MopsaLib.stmtGet the Python program from the flow
Utility functions
val mk_py_in :
?strict:bool ->
?left_strict:bool ->
?right_strict:bool ->
?esynthetic:bool ->
MopsaLib.expr ->
MopsaLib.expr ->
MopsaLib.expr ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval mk_py_not :
?esynthetic:bool ->
MopsaLib.expr ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval mk_except :
MopsaLib.expr option ->
MopsaLib.var option ->
MopsaLib.stmt ->
py_excptval mk_try :
?ssynthetic:bool ->
MopsaLib.stmt ->
py_excpt list ->
MopsaLib.stmt ->
MopsaLib.stmt ->
Mopsa_utils.Core.Location.range ->
MopsaLib.stmtval mk_raise :
?ssynthetic:bool ->
MopsaLib.expr ->
Mopsa_utils.Core.Location.range ->
MopsaLib.stmtval mk_py_call :
?esynthetic:bool ->
MopsaLib.expr ->
MopsaLib.expr list ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval mk_py_kall :
?esynthetic:bool ->
MopsaLib.expr ->
MopsaLib.expr list ->
(string option * MopsaLib.expr) list ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval mk_py_attr :
?esynthetic:bool ->
MopsaLib.expr ->
string ->
?etyp:MopsaLib.typ ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval mk_py_index_subscript :
?esynthetic:bool ->
MopsaLib.expr ->
MopsaLib.expr ->
?etyp:MopsaLib.typ ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval mk_py_object :
?esynthetic:bool ->
(MopsaLib.addr * MopsaLib.expr option) ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval mk_py_object_attr :
?esynthetic:bool ->
(MopsaLib.addr * MopsaLib.expr option) ->
string ->
?etyp:MopsaLib.typ ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval mk_py_bool :
?esynthetic:bool ->
bool ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval mk_py_true : Mopsa_utils.Core.Location.range -> MopsaLib.exprval mk_py_false : Mopsa_utils.Core.Location.range -> MopsaLib.exprval mk_py_top :
?esynthetic:bool ->
MopsaLib.typ ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval object_of_expr : MopsaLib.expr -> py_objectval mk_py_none :
?esynthetic:bool ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprDecorators
val is_stub_fundec : py_fundec -> boolval is_builtin_fundec : py_fundec -> boolval is_builtin_clsdec : py_clsdec -> boolval is_unsupported_fundec : py_fundec -> boolval is_unsupported_clsdec : py_clsdec -> boolval builtin_fundec_name : py_fundec -> stringval builtin_clsdec_name : py_clsdec -> stringval builtin_type_name : string -> py_fundec -> stringval py_or :
MopsaLib.expr ->
MopsaLib.expr ->
?esynthetic:bool ->
?etyp:MopsaLib.typ ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval py_and :
MopsaLib.expr ->
MopsaLib.expr ->
?esynthetic:bool ->
?etyp:MopsaLib.typ ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval mk_py_ll_hasattr :
?esynthetic:bool ->
MopsaLib.expr ->
MopsaLib.expr ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval mk_py_ll_getattr :
?esynthetic:bool ->
MopsaLib.expr ->
MopsaLib.expr ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval mk_py_ll_setattr :
?esynthetic:bool ->
MopsaLib.expr ->
MopsaLib.expr ->
MopsaLib.expr ->
Mopsa_utils.Core.Location.range ->
MopsaLib.exprval mk_py_ll_delattr :
?esynthetic:bool ->
MopsaLib.expr ->
MopsaLib.expr ->
Mopsa_utils.Core.Location.range ->
MopsaLib.expr