Page:Scheme - An interpreter for extended lambda calculus.djvu/34

From Wikisource
Jump to: navigation, search
This page has been proofread, but needs to be validated.
Sussman and Steele December 22, 1975 33 Implementation of the Interpreter

        (SETQ TEMP (OR **CLINK**
                      (ERROR '|PROCESS RAN OUT - RESTORE|
              **EXP** (CAR TEMP)
               TEMP (CDR TEMP)
              **UNEVLIS** (CAR TEMP)
               TEMP (CDR TEMP)
              **ENV** (CAR TEMP)
               TEMP (CDR TEMP)
              **EVLIS** (CAR TEMP)
               TEMP (CDR TEMP)
              **PC** (CAR TEMP)
               TEMP (CDR TEMP)
              **CLINK** (CAR TEMP))))

This is the central function of the SCHEME interpreter. This "instruction" expects **EXP** to contain an expression to evaluate, and **ENV** to contain the environment for the evaluation. The fact that we have arrived here indicates that **PC** contains 'AEVAL, and so we need not change **PC** if the next instruction is also to be AEVAL. Besides the obvious objects likes numbers, identifiers, LAMBDA expressions, and BETA expressions (closures), there are also several other objects of interest. There are primitive operators (LISP functions); AINTs (which are to SCHEME as FSUBRs like COND are to LISP); and AMACROs, which are used to implement DO, AND, OR, COND, BLOCK, etc.