Ast.StmtSourceStatements
This module is responsible for extending the Mopsa AST with new statements. This is done by creating new variant constructor of the extensible type stmt_kind, for instance
type stmt_kind += S_assign of expr * exprcreates a new assignment statement, which needs to be registered
let () = register_stmt {
compare = (fun next s1 s2 ->
match skind s1, skind s2 with
| S_assign(x1,e1), S_assign(x2,e2) ->
Compare.pair compare_expr compare_expr (x1,e1) (x2,e2)
| _ -> next s1 s2
);
print = (fun next s ->
match skind s with
| S_assign(x,e) -> Format.fprintf fmt "%a = %a;" pp_expr x pp_expr e
| _ -> next fmt s
);
}Extensible kinds of statements
type stmt = {skind : stmt_kind;kind of the statement
*)srange : Mopsa_utils.Location.range;location range of the statement
*)}Statements
Create a statement
Get the location range of a statement
register_stmt info registers a new statement by registering its compare function info.compare and pretty-printer info.print
Register a comparison function for statements
Register a pretty-printer function for statements
type stmt_kind += | S_program of Program.program * string list optionCommand-line arguments as given to Mopsa after --
Programs
mk_assign lhs rhs range creates the assignment lhs = rhs;
Create a test statement
type stmt_kind += | S_add of Expr.exprAdd a dimension to the environment
*)| S_remove of Expr.exprRemove a dimension from the environment and invalidate all references to it
*)| S_invalidate of Expr.exprInvalidate all references to a dimension without removing it
*)| S_rename of Expr.expr * Expr.exprnew
*)| S_forget of Expr.exprForget a dimension by putting ⊤ (all possible values) in it. Note that the dimension is not removed
*)| S_project of Expr.expr listProject the environment on the given list of dimensions. All other dimensions are removed
*)| S_expand of Expr.expr * Expr.expr listExpand a dimension into a list of other dimensions. The expanded dimension is untouched
*)| S_fold of Expr.expr * Expr.expr listFold a list of dimensions into a single one. The folded dimensions are removed
*)| S_block of stmt list * Var.var listlocal variables declared within the block
*)| S_breakpoint of stringTrigger a breakpoint
*)Dimensions
Utility functions to create various statements for dimension management
module StmtSet : Mopsa_utils.SetExtSig.S with type elt = stmtSets of statements
module StmtMap : Mopsa_utils.MapExtSig.S with type key = stmtMaps of statements