This page needs to be proofread.
41
main: <code for a> ;result in regl
name1: JUMP-IF-NIL regl,namela
RETURN ;return the value in reg1
name1a:
name2: <code for b> ;result in regl
name3: JUMP-IF-NIL reg1,name3a
RETURN ;return the value in reg2
name3a:
name4: <code for c> ;result in reg1
name5: JUMP-IF-NIL reg1,name5a
RETURN ;return the value in reg1
name5a:
name6: LOAD reg1,'NIL ;constant NIL in reg1
RETURN
This code is in fact about what one would expect out of an ordinary LISP compiler. (There is admittedly room for a little more improvement.) RABBIT indeed produces code of essentially this form, by the method of analysis outlined here.
Similar considerations hold for the BLOCK macro. Consider the expression (BLOCK a b c); conceptually this should perform a, b, and c sequentially. Let us examine the code produced: '
((LAMBDA (A B) (B))
a
(LAMBDA () ((LAMBDA (A B) (B))
b
(LAMBDA () C))))
Renaming the variables and assigning names to LAMBDA-expressions:
((LANBDA name1 (A1 B1) (B1)) (LAMBDA name2 () ((LAMBDA name3 (A2 B2) (B2))
b (LAMBDA name4 () c))))
Producing code for the functions: