-----

Compiler Steps 7-9: Assembler Generation

-----

Step 7: Assembler-Specific Rewrite Rules

This step applies scheme-to-scheme rewrite rules that are required for assembler and not C. At the moment, this consists only of converting forms headed by AND and OR into binary-if statements. This rewrite is simple because the coprocessor's sublanguage does not allow miscellaneous objects to be used in place of booleans.

Step 8: Assembler Linearization

This step converts the code into a linear sequence of stack machine operations, with symbolic variable names and symbolic jump points. Each operation is a pair consisting of an op-code-name followed (if required) by an argument (numerical argument, symbolic jump point, or variable name).

The basic algorithm is as follows:

Step 8 uses type information to determine how to remove output from the stack when required and to distinguish functions that are still overloaded at this stage. The types of variables are stored in the symbol table. The heads of complex expressions have been decorated with their output type at the end of step 6.

Assembler generation disregards the distinction between guaranteed-/ and /, guaranteed-modulo and modulo, and guaranteed-quotient and quotient. The operation - is renamed to minus.

Step 9: Assembler Linking

This step converts the code into a linear sequence of stack machine operations. Each operation is list of up to four elements: line-number, op-code-name, argument (if required), variable name (for get/set instructions).

The output of this step is sent to the coprocessor, for installation in its function table. The interface function translates the op-code names into op-code numbers.

-----

Ownership, Maintenance and Disclaimers

Manual Top Page

Last modified