Next: compiler direct jumps, Previous: compiler unsafe primrefs, Up: compiler [Index]
This compiler pass makes sure that every clamba
struct appears
as direct right–hand side expression in a fix
struct:
(fix ((?lhs ?clambda)) ?body)
The following bindings are exported by the library (vicare
compiler)
.
Perform code transformations traversing the whole hierarchy in input, which must be a struct instance representing recordised code, and building a new hierarchy of recordised code; return the new hierarchy.
Perform the following transformations:
clambda
structs that already appear as RHS of fix
structs are left alone.
clambda
structs appearing as RHS in single–binding
bind
structs cause the bind
struct to be replaced by
a fix
struct:
(bind ((?lhs ?clambda)) ?body) → (fix ((?lhs ?clambda)) ?body)
clambda
structs appearing as RHS in multiple–binding
bind
structs cause the bind
struct to be split into
a bind
struct and a fix
struct in which the bindings
are partitioned:
(bind ((?lhs0 ?clambda) (?lhs1 ?rhs)) ?body) → (bind ((?lhs1 ?rhs)) (fix ((?lhs0 ?clambda)) ?body))
clambda
structs appearing as standalone expressions (that is:
not directly as RHS of a bind
or fix
struct) are
“lifted” as follows:
(clambda (?formals ?body) ...) → (fix ((tmp (clambda (?formals ?body) ...))) tmp)
In the returned struct of recordised code: all the clambda
structs appear in the code as right–hand side initialisation
expressions of fix
structs; all the bind
structs
have a non–clambda
struct as right–hand side initialisation
expression.