[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:

   

424  'type' LABEL 
425  'type' FLOAT 
  
426  'action' LDA(INT, INT) 
427  'action' LDC(INT, INT)  
428  'action' LDF(FLOAT) 
429  'action' LDI            
430  'action' STI 
431  'action' JMP(LABEL) 
432  'action' FJP(LABEL) 
433  'action' ADD(INT)       
434  'action' SUB 
435  'action' MUL(INT)       
436  'action' INV 
437  'action' LES(INT) 
438  'action' IXA(INT) 
439  'action' FLT            
440  'action' WRI(INT) 
441  'action' REA(INT)       
442  'action' MST(INT) 
443  'action' JSR(INT, LABEL) 
444  'action' ENT(INT)       
445  'action' RET            
446  'action' CHK(INT, INT) 
  
447  'action' NewLabel(-> L: LABEL) 
448  'action' LAB(L: LABEL) 
449  'action' Emit 


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, 20
to 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).



[NEXT] [PREV]