Sussman and Steele | December 22, 1975 | 38 | Implementation of the Interpreter |
source of bugs; much care is required).
(DEFUN TERMINATE () (COND ((NULL **QUEUE**) (SETQ **PROCESS** (CREATE!PROCESS '(**TOP** '|SCHEME -- QUEUEOUT|)))) (T (SETQ **PROCESS** (CAR **QUEUE**) **QUEUE** (CDR **QUEUE**)))) (SETQ **CLINK** (GET **PROCESS** 'CLINK)) (SETQ **VAL** (GET **PROCESS** 'VAL)) 'TERMINATE-VALUE)
EVALUATE!UNINTERRUPTIBLY
merely binds the variable *ALLOW*
to NIL
, and then evaluates its argument. This is why this primitive follows the scoping rules for variables!
(DEFPROP EVALUATE!UNINTERRUPTIBLY EVALUATE!UNINTERRUPTIBLY AINT) (DEFUN EVALUATE!UNINTERRUPTIBLY () (SETQ **ENV** (CONS (LIST '*ALLOW* NIL) **ENV**) **EXP** (CADR **EXP**) **PC** 'AEVAL))
DEFINE
closes the function to be defined in the null environment, and installs the closure in the LISP value cell.
(DEFPROP DEFINE DEFINE AINT) (DEFUN DEFINE () (SET (CADR **EXP**) (LIST 'BETA (CADDR **EXP**) NIL)) (SETQ **VAL** (CADR **EXP**)) (RESTORE))
ASET
looks up the specified variable in the current environment, and clobbers the value cell in the environment with the new value. If the variable is not bound in the current environment, the LISP value cell is set. Note that ASET
does not need to be an AINT
, since it does not fool with order of evaluation; all it needs is access to the "machine register" **ENV**
.
(DEFUN ASET (VAR VALU) (SETQ **TEM** (ASSQ VAR **ENV**)) (COND (**TEM** (RPLACA (CDR **TEM**) VALU)) (T (SET VAR VALU))) VALU)
CATCH
binds the tag variable to a DELTA
expression which contains the current CLINK
. When AEVAL
applies such an expression as a function (of one argument), it makes the **CLINK**
in the DELTA
expression be the **CLINK**
, places the value of the argument in **VAL**
, and does a RESTORE
. The effect is to return from the CATCH
expression with the argument to the DELTA