shithub: femtolisp

ref: 489a3e1552b528eb06fc393bd8f5a66702ca82c2
dir: /mkboot0.lsp/

View raw version
; -*- scheme -*-

(define update-compiler
   (let ((C ()))
     (with-bindings
       ((eval (λ (x) (set! C (cons (compile-thunk (expand x)) C)))))
       (begin
         (load "instructions.lsp")
         (load "compiler.lsp")))
     (λ () (begin
             (for-each (λ (x) (x)) (reverse! C))
             (set! update-compiler (λ () ()))))))

(define (compile-file inf)
  (let ((in  (file inf :read)))
    (let next ((E (read in)))
      (if (not (io-eof? in))
          (begin
             (print (compile-thunk (expand E)))
                 (newline)
                 (next (read in)))))
    (io-close in)))

(define (do-boot0)
  (for-each (λ (file)
              (compile-file file))
              (cdr *argv*)))

(update-compiler)
(do-boot0)