package mopsa
Install
Dune Dependency
Authors
Maintainers
Sources
md5=fdee20e988343751de440b4f6b67c0f4
sha512=f5cbf1328785d3f5ce40155dada2d95e5de5cce4f084ea30cfb04d1ab10cc9403a26cfb3fa55d0f9da72244482130fdb89c286a9aed0d640bba46b7c00e09500
doc/ast/Ast/Stmt/index.html
Module Ast.Stmt
Source
Statements
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 * expr
creates 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
Registration
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
Blocks
Common statements
type stmt_kind +=
| S_program of Program.program * string list option
(*Command-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.expr
(*Add a dimension to the environment
*)| S_remove of Expr.expr
(*Remove a dimension from the environment and invalidate all references to it
*)| S_invalidate of Expr.expr
(*Invalidate all references to a dimension without removing it
*)| S_rename of Expr.expr * Expr.expr
(*new
*)| S_forget of Expr.expr
(*Forget a dimension by putting ⊤ (all possible values) in it. Note that the dimension is not removed
*)| S_project of Expr.expr list
(*Project the environment on the given list of dimensions. All other dimensions are removed
*)| S_expand of Expr.expr * Expr.expr list
(*Expand a dimension into a list of other dimensions. The expanded dimension is untouched
*)| S_fold of Expr.expr * Expr.expr list
(*Fold a list of dimensions into a single one. The folded dimensions are removed
*)| S_block of stmt list * Var.var list
(*local variables declared within the block
*)| S_breakpoint of string
(*Trigger a breakpoint
*)
Dimensions
Utility functions to create various statements for dimension management
Containers of statements
module StmtSet : Mopsa_utils.SetExtSig.S with type elt = stmt
Sets of statements
module StmtMap : Mopsa_utils.MapExtSig.S with type key = stmt
Maps of statements