Scalc.Utils
val subst_expr : Ast.VarName.t -> Ast.expr -> Ast.expr -> Ast.expr
subst_expr var replacement within_expr
substitutes replacement
for var
within within_expr
.
val subst_block :
Ast.VarName.t ->
Ast.expr ->
Shared_ast.typ ->
Catala_utils.Pos.t ->
Ast.block ->
Ast.block
subst_expr var replacement typ pos block
substitutes replacement
for var
within the given block
. If not possible (the variable appears in a variable-only position), the block is returned with an initialisation of var
with replacement
prepended
val find_block :
(Ast.stmt Catala_utils.Mark.pos -> bool) ->
Ast.block ->
Ast.stmt Catala_utils.Mark.pos option
Recurses into branchings, but not function bodies
val filter_map_block :
(Ast.stmt Catala_utils.Mark.pos -> 'a option) ->
Ast.block ->
'a list
Recurses into branchings, but not function bodies
val get_vars : Ast.expr -> Ast.VarName.Set.t