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

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

expression as its value (can you see why?).

(DEFPROP CATCH ACATCH AINT)

(DEFUN ACATCH ()
       (SETQ **ENV** (CONS (LIST (CADR **EXP**) (LIST 'DELTA **CLINK**)) **ENV**)
             **EXP** (CADDR **EXP**)
             **PC** 'AEVAL))

PAIRLIS is as in the LISP 1.5 Programmer's Manual [McCarthy][1].

(DEFUN PAIRLIS (X Y Z)
       (DO ((I X (CDR I))
            (J Y (CDR J))
            (L Z (CONS (LIST (CAR I) (CAR J)) L)))
           ((AND (NULL I) (NULL J)) L)
           (AND (OR (NULL I) (NULL J))
                (ERROR '|WRONG NUMBER OF ARGUMENTS - PAIRLIS|
                       **EXP**
                       'WRNG-NO-ARGS))))

AMACROs are fairly complicated beasties, and have very little to do with the basic issues of the implementation of SCHEME per se, so the code for them will not be given here. AMACROs behave almost exactly like MacLISP macros [Moon][2].

This is the end of the SCHEME interpreter!

  1. [McCarthy]
    McCarthy, John, et al. LISP 1.5 Programmer's Manual. The MIT Press (Cambridge, 1965).
  2. [Moon]
    Moon, David A. MACLISP Reference Manual, Revision 0. Project MAC, MIT (Cambridge, April 1974).