Jump to content

Page:AITR-474.djvu/29

From Wikisource
This page has been proofread, but needs to be validated.

19

PROG; it is never used to return a value of any kind. LAMBDA-expressions are used only to bind temporary variables. In addition, CONS, CAR, CDR, RPLACA, and RPLACD are used in the creation and manipulation of environments.

We may draw a parallel between each of these constructs and an equivalent machine-language (or rather, assembly language) construct:

PROG
A single program module.
GO
A branch instruction. PROG tags correspond to instruction labels.
RETURN
Exit from program module.
PROGN
Sequencing of several instructions.
COND
Conditional branches, used in a disciplined manner. One may think of
(COND (pred1 value1) 
      (pred2 value2)
      ...
      (predn valuen)) 

as representing the sequence of code

       <code for pred1> 
       JUMP-IF-NIL reg1,TAG1 
       <code for value1> 
       JUMP ENDTAG 
TAG1:  <code for pred2> 
       JUMP-IF-NIL regl,TAG2 
       <code for value2>
       JUMP ENDTAG
TAG2:  ...
       <code for predn> 
       JUMP-IF-NIL reg1,TAGn 
       <code for valuen> 
       JUMP ENDTAG 
TAGn:  LOAD-VALUE NIL 
ENDTAG: 
which admits of some optimizations, but we shall not worry about this. (The MacLISP compiler does, but we do not depend at all on this fact.)
SETQ
Load register, or store into memory.