This section provides a formal denotational semantics for the primitive expressions of Scheme and selected built-in procedures. The concepts and notation used here are described in Denotational Semantics: The Scott-Strachey Approach to Programming Language Theory39; the definition of dynamic-wind is taken from How to Add Threads to a Sequential Language Without Getting Tangled Up40. The notation is summarized below:
The reason that expression continuations take sequences of values instead of single values is to simplify the formal treatment of procedure calls and multiple return values.
The boolean flag associated with pairs, vectors, and strings will be true for mutable objects and false for immutable objects.
The order of evaluation within a call is unspecified. We mimic that here by applying arbitrary permutations and , which must be inverses, to the arguments in a call before and after they are evaluated. This is not quite right since it suggests, incorrectly, that the order of evaluation is constant throughout a program (for any given number of arguments), but it is a closer approximation to the intended semantics than a left-to-right evaluation would be.
The storage allocator is implementation-dependent, but it must obey the following axiom:
The definition of is omitted because an accurate definition of would complicate the semantics without being very interesting.
If is a program in which all variables are defined before being referenced or assigned, then the meaning of is
where is the sequence of variables defined in , is the sequence of expressions obtained by replacing every definition in by an assignment, is an expression that evaluates to , and is the semantic function that assigns meaning to expressions.
Joseph E. Stoy. Denotational Semantics: The Scott-Strachey Approach to Programming Language Theory. MIT Press, Cambridge, 1977.
Martin Gasbichler, Eric Knauel, Michael Sperber and Richard Kelsey. How to Add Threads to a Sequential Language Without Getting Tangled Up. Proceedings of the Fourth Workshop on Scheme and Functional Programming, November 2003.