The output of step 6 is an intermediate language which differs significantly from the user-level language.

All local variables are recorded in the local symbol table, along with their types.

Except where indicated, all functions take a fixed number of inputs, with a fixed pattern of types, and produce output of a fixed type. Overloading has been resolved by assigning distinct names for different input types. (When compiling into C, later steps may re-introduce overloading for some of these functions.)

The inputs to an arithmetic function are either all integers or all reals. If the original call contained a mixture of real and integer inputs, floating point contagion has been applied to wrap exact->inexact around the integers.

Only structure and sheet accessors and assembly operations take vectors as inputs or produce vector outputs.

Only begin, return, and multiple-set! take a variable number of inputs.

All checking for missing input values has been explicitly coded, as is range checking for point-coordinate.

The head of each expression is marked with its type. The head is a vector, whose first element is the type and whose second element is the operation name.

Control primitives: begin, while, return, binary-if, unary-if, set!, multiple-set!, constant-set!, icp-error, and, or, not

While forms do not occur inside expressions.

All return values are enclosed in return forms.

Multiple-set! forms only occur immediately surrounding calls to external co-processor functions which return multiple values.

All calls to other coprocessor functions are directly inside a set! or multiple-set! form.

There are two type coercion functions: inexact->exact (real inputs), exact->inexact (integer inputs)

These operations only need to handle 1D points of the correct type. They need to check whether their input is missing.

Handlers for missing values include: missing?, make-missing-real, make-missing-integer

Operations on sheets and samples can take points, sheets, or samples of any dimension.

Sheet reference operators: integer-sheet-ref (on-grid reference), real-sheet-ref (interpolated reference), unscaled-sheet-set!

Scaling and offset: sheet-domain-scaling, sheet-domain-offset, sheet-codomain-scaling, sheet-codomain-offset

Samples: sheet-min-sample, sheet-max-sample, focus-min-sample, focus-max-sample, sample-unscaled-point, sample->sheet, make-sample

Vector structure accessors: make-point, point-coordinate

Integer-only numerical tests: =

Real or integer numerical tests: <, >, <=, >=

These functions always take real inputs and return a single real output. They do not take vector inputs.

unary: log, exp, sqrt, sin, cos, tan, asin, acos, unary-atan, floor, ceiling, round, truncate

binary: random-real, binary-atan, expt, /, guaranteed-/

The coprocessor code for these operations must check the following conditions and return a missing value in these cases:

- both of binary-atan's inputs are zero
- the input to log is zero or negative
- the input to sqrt is negative
- the input to asin or acos is outside the range [-1,1]
- the first input to random-real is greater than the second
- either the first input to expt is zero and the second input is negative, or the first input is negative and the second input is not an integer
- the second input to / is zero

Guaranteed-/ is a form of / whose second input cannot be zero, created during expansion of sheet-ref and sample-set!.

These functions always take integer inputs and return a single integer output.

unary: bitwise-not

binary: bitwise-and, bitwise-ior, bitwise-xor, arithmetic-shift, remainder, quotient, modulo, guaranteed-quotient guaranteed-modulo

An error should be flagged if the second input to remainder, quotient, or modulo is zero. Guaranteed-quotient and guaranteed-modulo are versions of quotient and modulo whose second inputs cannot be zero. They are created during expansion of sheet-ref and sample-set!.

These functions have two variants: one handles integer inputs and the other handles real inputs.

unary: unary-minus, abs

binary: min, max, +, -, *

Ownership, Maintenance and Disclaimers

Last modified