|
[NEXT] [PREV]
HANDBOOK
/ CASE STUDY
/ The Compiler
/Target Interface |
||||||
|
Gentle
Applications Concepts Examples Handbook Support Download
|
The virtual MiniLAX machine is implemented as a C module.
Here is the Gentle interface for this module:
For each instruction ( LDA, LDC, ... , CHK), there is a corresponding predicate. For example, 'action' CHK (INT, INT)corresponds to the ICode CHK instruction. CHK (1, 20)appends an instruction CHK 1, 20to the target program. The type Label comprises ``symbolic values'' that are used as labels; final machine addresses are not used as instruction operands. The translation of symbolic values into addresses is done by the virtual machine if the program is complete. A new label is created by NewLabel(-> Lab)Thereafter, Lab can be used in instructions, e.g. JMP(Lab)The location of the label must be defined by the pseudo-instruction LAB(Lab)which defines the following instruction as the target of a jump to Lab.
The action Emit writes the target program into a file
(alternatively, it could be interpreted directly).
|