Sussman and Steele | December 22, 1975 | 36 | Implementation of the Interpreter |
(DEFPROP EVALUATE EVALUATE AINT) (DEFUN EVALUATE () (SAVEUP 'EVALUATE1) (SETQ **EXP** (CADR **EXP**) **PC** 'AEVAL)) (DEFUN EVALUATE1 () (SETQ **EXP** **VAL** **PC** 'AEVAL))
IF
evaluates its first argument, with a return address of IF1
. IF1
examines the resulting **VAL**
, and gives either the second or third argument to AEVAL
depending on whether the **VAL**
was non-NIL
or NIL
.
(DEFPROP IF IF AINT) (DEFUN IF () (SAVEUP 'IF1) (SETQ **EXP** (CADR **EXP**) **PC** 'AEVAL)) (DEFUN IF1 () (COND (**VAL** (SETQ **EXP** (CADDR **EXP**))) (T (SETQ **EXP** (CADDDR **EXP**)))) (SETQ **PC** 'AEVAL))
As it was in the beginning, is now, and ever shall be: QUOTE
without end. (Amen, amen.)
(DEFPROP QUOTE AQUOTE AINT) (DEFUN AQUOTE () (SETQ **VAL** (CADR **EXP**)) (RESTORE))
LABELS
merely feeds its second argument to AEVAL
after constructing a fiendishly clever environment structure. This is done in two stages: first the skeleton of the structure is created, with null environments in the closures of the bound functions; next the created environment is clobbered into each of the closures.