module CaseMap:Extensions.Map.S with type key = int
Emptyexpression is an
expressionwithout a downlink to an
module Empty: sig
Empty.t. However, there can be expressions whose type is not
Empty.twhich are empty. For that reason the presence of empty expressions should always be temporary.
val is_empty: expression → bool
val empty: expression → t
t(which was empty) to some
expression_, and return
t(which is no longer empty)
val fill: t → expression_ → expression
set_enclosingfunctions are dangerous, as they may break invariants on Cps expressions; for that reason, one should rather use the
Cpschangemodule, that performs modifications while maintaining those invariants.
module Expression: sig
expression_in an expression.
val get: expression → expression_
val set: expression → expression_ → unit
enclosingof an expression.
val enclosing: expression → enclosing
val set_enclosing: expression → enclosing → unit
?reconnectargument is given,
expression_argument, and return it. Else, it returns a new fresh expression, with downlink to a
expression_. Thus depending on
reconnectthe argument, make will return a non-fresh or a fresh expression.
val make: ?reconnect:Empty.t → expression_ → expression
val discard: expression → unit
expressionwithout an uplink to an enclosing expression or definition.
module Fresh: sig
(∗ Fresh expressions are very similar to expressions; only the "enclosing" operation is forbidden. For that reason, the type
tis not made abstract, as it is too inconvenient to split the functions that apply on both. But ideally,
Fresh.twould have been a supertype of type
type t = expression
val make: expression_ → t
val get: t → expression_
val is_fresh: expression → bool
set_enclosing fresh encllosingsets
enclosingas the enclosing term for
freshmust be fresh.
val set_enclosing: t → enclosing → unit
Cps.Base.VAR, which includes the write operations.
type occur_type = Cpsvar.occur_type = Recursive ∣ Non_recursive
module type VAR_RW = sig
with" declarations, contrary to the types inside the submodules
Occur. So they can be used as "gateways" to specify the types in these submodules.
makecreates an empty variable, to be used in a CPS expression; when this expression is made,
initsets the uplink to it. This is all handled by
val make : unit → var
val init: var → enclosing → unit
type number_of_occurrences =
∣ One_occurrence of occur
val number_of_occurrences: var → number_of_occurrences
val fold_on_occurrences: var → α → (α → occur → α) → α
replace_with v1 v2makes all occurrences of
v1become occurrences of
val replace_with: var → var → unit
val replace_all_non_recursive_occurrences_of_with: var → var → unit
val binding_site: var → enclosing
val set_binding_site: var → enclosing → unit
make (var,occur_type)creates a
var. The pair (var,occur_type) thus allows to create a new occurrence, and is called an
rec_makerare helper functions that return
type maker = var × occur_type
val maker : var → maker
val rec_maker: var → maker
val make : maker → occur
val delete: occur → unit