[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Making the KCL compiler recursive

Here is a way to make the KCL compiler recursive.  It should work for both
KCL and AKCL.  To make this message shorter, the comments beginning with
";***" give instructions that you will need to follow.

  Rick Harris

;Beginning of patches.
(in-package "COMPILER")

(defvar *cmpvar-list* nil)
(defmacro defcmpvar (name form)
  `(eval-when (compile load eval)
     (defvar ,name ,form)
     (addcmpvar ',name ',form)))

(defun addcmpvar (name form)
  (let ((a (assoc name *cmpvar-list*)))
    (if a
	(setf (cadr a) form)
	(push (list name form) *cmpvar-list*)))

(defmacro in-compiler (&body forms)
       (mapcar #'car *cmpvar-list*)
       (mapcar #'(lambda (v-f) (eval (cadr v-f))) *cmpvar-list*)
;*** For each setq in init-env (found in cmpnew/cmpenv.lsp),
;*** put a defcmpvar form here.
;*** (for example, init-env contains "(setq *next-cvar* 0)", 
;***  so put "(defcmpvar *next-cvar* 0)" here)

;*** Extract the definitions of compile-file1, compile1, and disassemble1 
;*** (found in cmpnew/cmpmain.lsp), and put them here.
;*** For each function:
;***   1) The first (or maybe second) form begins "(cond (*compiler-in-use*".
;***      Remove this form.
;***   2) Replace the first occurrence of "(init-env)" with "(in-compiler",
;***      and the second occurrence of "(init-env)" with ")".

;End of patches.