anchor.diff:  (COMPILE 'kl-cycle)
   (COMPILE 'flip)
   (COMPILE 'write-out-kl)
  +
  +(ENSURE-DIRECTORIES-EXIST NATIVE-PATH)
   
   (import-lsp "primitives")
   (import-lsp "backend")
  
positive.code: (FMAKUNBOUND 'import-lsp)
  (FMAKUNBOUND 'import-kl)
  
  #+CLISP (EXT:SAVEINITMEM
    (FORMAT NIL "~A~A" NATIVE-PATH MEM-NAME)
    :INIT-FUNCTION 'SHEN-TOPLEVEL)
  
  #+CLISP (QUIT)
  
  #+CCL (CCL:SAVE-APPLICATION
    (FORMAT NIL "~A~A" NATIVE-PATH EXECUTABLE-NAME)
    :PREPEND-KERNEL T
    :TOPLEVEL-FUNCTION 'SHEN-TOPLEVEL)
  
  #+CCL (QUIT)
  
  #+SBCL (SAVE-LISP-AND-DIE
    (FORMAT NIL "~A~A" NATIVE-PATH EXECUTABLE-NAME)
    :EXECUTABLE T
    :SAVE-RUNTIME-OPTIONS T
    :TOPLEVEL 'SHEN-TOPLEVEL)
  
negative.code: ; Assumes *.kl files are in the ./kernel/klambda directory
  ; Creates intermediate code and binaries in a platform-specific sub-directory under ./native/
  
  (PROCLAIM '(OPTIMIZE (DEBUG 0) (SPEED 3) (SAFETY 3)))
  (IN-PACKAGE :CL-USER)
  (SETF (READTABLE-CASE *READTABLE*) :PRESERVE)
  (SETQ *language* "Common Lisp")
  (SETQ *port* 2.0)
  (SETQ *porters* "Mark Tarver")
  
  #+CLISP
  (PROGN
    (SETQ *implementation* "GNU CLisp")
    (SETQ *release* (LET ((V (LISP-IMPLEMENTATION-VERSION))) (SUBSEQ V 0 (POSITION #\SPACE V :START 0))))
    (SETQ *os* (OR #+WIN32 "Windows" #+LINUX "Linux" #+UNIX "Unix" "Unknown"))
    (DEFCONSTANT NATIVE-PATH "./native/clisp/")
    (DEFCONSTANT COMPILED-SUFFIX ".fas")
    (DEFCONSTANT BINARY-NAME "shen.mem")
    (SETQ CUSTOM:*COMPILE-WARNINGS* NIL)
    (SETQ *COMPILE-VERBOSE* NIL))
  
  #+CCL
  (PROGN
    (SETQ *implementation* "Clozure CL")
    (SETQ *release* (LISP-IMPLEMENTATION-VERSION))
    (SETQ *os* (OR #+WINDOWS "Windows" #+LINUX "Linux" #+UNIX "Unix" "Unknown"))
    (DEFCONSTANT NATIVE-PATH "./native/ccl/")
    (DEFCONSTANT COMPILED-SUFFIX (OR #+WINDOWS ".wx64fsl" #+LINUX ".lx64fsl" ".unknown")) ; TODO: need a better way to do this
    (DEFCONSTANT BINARY-NAME #+WINDOWS "shen.exe" #-WINDOWS "shen"))
  
  #+SBCL
  (PROGN
    (SETQ *implementation* "SBCL")
    (SETQ *release* (LISP-IMPLEMENTATION-VERSION))
    (SETQ *os* (OR #+WIN32 "Windows" #+LINUX "Linux" #+UNIX "Unix" "Unknown"))
    (DEFCONSTANT NATIVE-PATH "./native/sbcl/")
    (DEFCONSTANT COMPILED-SUFFIX ".fasl")
    (DEFCONSTANT BINARY-NAME #+WIN32 "shen.exe" #-WIN32 "shen")
    (DECLAIM (SB-EXT:MUFFLE-CONDITIONS SB-EXT:COMPILER-NOTE))
    (SETF SB-EXT:*MUFFLED-WARNINGS* T))
  
  (DEFUN import-kl (File)
    (LET ((KlFile       (FORMAT NIL "./kernel/klambda/~A.kl" File))
          (IntermedFile (FORMAT NIL "~A~A.intermed" NATIVE-PATH File))
          (LspFile      (FORMAT NIL "~A~A.lsp" NATIVE-PATH File))
          (ObjFile      (FORMAT NIL "~A~A~A" NATIVE-PATH File COMPILED-SUFFIX)))
      (prepare-kl KlFile IntermedFile)
      (translate-kl IntermedFile LspFile)
      (COMPILE-FILE LspFile)
  