Next: , Up: compiler recordize   [Index]


17.8.1 Recordisation of bindings

The core language forms that define bindings are:

(library-letrec* ((?lhs ?loc ?rhs) ...) ?body)
(let     ((?lhs ?rhs) ...) ?body)
(letrec  ((?lhs ?rhs) ...) ?body)
(letrec* ((?lhs ?rhs) ...) ?body)
(lambda ?formals ?body)
(case-lambda (?formals ?body) ...)
(annotated-case-lambda ?annotation (?formals ?body) ...)

and as special case:

(set! ?lhs ?rhs)

when present at the top level. In all these expressions ?lhs is a lexical gensym uniquely identifying the binding.

The recordisation process transforms:

Undefined bindings and previously defined bindings

In the core language input expression: if a binding is defined by the expression itself, its lex gensym is present as left–hand side in a let, letrec, letrec*, library-letrec* form or as formal argument in a lambda, case-lambda, annotated-case-lambda form. Otherwise the lex gensym represents an undefined binding or a binding defined outside the input form.

Every symbol in the input form not present as left–hand side in a bind, recbind, rec*bind struct or formal argument in a clambda struct is interpreted as a reference to undefined or previously defined binding. This interpretation includes:

for all these cases: the lex gensym acts also as loc gensym.

After the recordisation process:

so all the prelex structs introduced by recordize represent bindings defined by the input expression.

NOTE As specified by R6RS, bindings defined by imported libraries must not be mutated; this means core language forms like:

(set! ?loc ?rhs)

in which ?loc is the loc gensym of an imported binding are forbidden. It is the responsibility of the expander not to generate such assignment forms for bindings defined by imported libraries.

NOTE The special handling of core language assignment forms:

(set! ?lex ?rhs)

in which ?lex is both the lex and loc gensym of a binding not defined by the input expression allows:


Next: , Up: compiler recordize   [Index]