* Added a "boot-library-expand" to separate the top-library
expander from the experimental expander.
This commit is contained in:
parent
718b20767f
commit
671e2f475c
BIN
src/ikarus.boot
BIN
src/ikarus.boot
Binary file not shown.
|
@ -979,6 +979,7 @@
|
||||||
[generate-temporaries generate-temporaries-label (core-prim . generate-temporaries)]
|
[generate-temporaries generate-temporaries-label (core-prim . generate-temporaries)]
|
||||||
[free-identifier=? free-identifier=?-label (core-prim . free-identifier=?)]
|
[free-identifier=? free-identifier=?-label (core-prim . free-identifier=?)]
|
||||||
[chi-top-library chi-top-library-label (core-prim . chi-top-library)]
|
[chi-top-library chi-top-library-label (core-prim . chi-top-library)]
|
||||||
|
[boot-library-expand boot-library-expand-label (core-prim . boot-library-expand)]
|
||||||
;;; codes
|
;;; codes
|
||||||
[$closure-code $closure-code-label (core-prim . $closure-code)]
|
[$closure-code $closure-code-label (core-prim . $closure-code)]
|
||||||
[$code? $code?-label (core-prim . $code?)]
|
[$code? $code?-label (core-prim . $code?)]
|
||||||
|
@ -2387,7 +2388,7 @@
|
||||||
r mr lhs* lex* rhs* kwd*)]
|
r mr lhs* lex* rhs* kwd*)]
|
||||||
[else
|
[else
|
||||||
(return e* module-init** r mr lhs* lex* rhs*)]))))]))))
|
(return e* module-init** r mr lhs* lex* rhs*)]))))]))))
|
||||||
(define library-expander^
|
(define library-expander
|
||||||
(lambda (e)
|
(lambda (e)
|
||||||
(let-values ([(name exp* b*) (parse-library e)])
|
(let-values ([(name exp* b*) (parse-library e)])
|
||||||
(let ([rib (make-scheme-rib)]
|
(let ([rib (make-scheme-rib)]
|
||||||
|
@ -2404,11 +2405,6 @@
|
||||||
(build-void)
|
(build-void)
|
||||||
(build-sequence no-source
|
(build-sequence no-source
|
||||||
(chi-expr* init* r mr))))))))))
|
(chi-expr* init* r mr))))))))))
|
||||||
(define library-expander
|
|
||||||
(lambda (x)
|
|
||||||
(let ([v (library-expander^ x)])
|
|
||||||
;(pretty-print v)
|
|
||||||
v)))
|
|
||||||
(primitive-set! 'identifier? id?)
|
(primitive-set! 'identifier? id?)
|
||||||
(primitive-set! 'generate-temporaries
|
(primitive-set! 'generate-temporaries
|
||||||
(lambda (ls)
|
(lambda (ls)
|
||||||
|
@ -2430,6 +2426,7 @@
|
||||||
(apply string-append args)
|
(apply string-append args)
|
||||||
(strip x '()))))
|
(strip x '()))))
|
||||||
(primitive-set! 'syntax-dispatch syntax-dispatch)
|
(primitive-set! 'syntax-dispatch syntax-dispatch)
|
||||||
|
(primitive-set! 'boot-library-expand library-expander)
|
||||||
(primitive-set! 'chi-top-library library-expander))
|
(primitive-set! 'chi-top-library library-expander))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,30 +5,46 @@
|
||||||
(import (scheme))
|
(import (scheme))
|
||||||
|
|
||||||
(define scheme-library-files
|
(define scheme-library-files
|
||||||
'("libhandlers.ss"
|
;;; Listed in the order in which they're loaded.
|
||||||
"libcontrol.ss"
|
;;;
|
||||||
"libcollect.ss"
|
;;; Loading of the boot file may segfault if a library is
|
||||||
"librecord.ss"
|
;;; loaded before its dependencies are loaded first.
|
||||||
"libcxr.ss"
|
;;;
|
||||||
"libnumerics.ss"
|
;;; reason is that the base libraries are not a hierarchy of
|
||||||
"libguardians.ss"
|
;;; dependencies but rather an eco system in which every
|
||||||
"libcore.ss"
|
;;; part depends on the other.
|
||||||
"libchezio.ss"
|
;;;
|
||||||
"libhash.ss"
|
;;; For example, the printer may call error if it finds
|
||||||
"libwriter.ss"
|
;;; an error (e.g. "not an output port"), while the error
|
||||||
"libtokenizer.ss"
|
;;; procedure may call the printer to display the message.
|
||||||
"libassembler.ss"
|
;;; This works fine as long as error does not itself cause
|
||||||
"libintelasm.ss"
|
;;; an error (which may lead to the infamous Error: Error:
|
||||||
"libfasl.ss"
|
;;; Error: Error: Error: Error: Error: Error: Error: ...).
|
||||||
"libtrace.ss"
|
;;;
|
||||||
"libcompile.ss"
|
'("libhandlers.ss"
|
||||||
"libsyntax.ss"
|
"libcontrol.ss"
|
||||||
"libpp.ss"
|
"libcollect.ss"
|
||||||
"libcafe.ss"
|
"librecord.ss"
|
||||||
"libposix.ss"
|
"libcxr.ss"
|
||||||
"libtimers.ss"
|
"libnumerics.ss"
|
||||||
|
"libguardians.ss"
|
||||||
|
"libcore.ss"
|
||||||
|
"libchezio.ss"
|
||||||
|
"libhash.ss"
|
||||||
|
"libwriter.ss"
|
||||||
|
"libtokenizer.ss"
|
||||||
|
"libassembler.ss"
|
||||||
|
"libintelasm.ss"
|
||||||
|
"libfasl.ss"
|
||||||
|
"libtrace.ss"
|
||||||
|
"libcompile.ss"
|
||||||
|
"libsyntax.ss"
|
||||||
|
"libpp.ss"
|
||||||
|
"libcafe.ss"
|
||||||
|
"libposix.ss"
|
||||||
|
"libtimers.ss"
|
||||||
"libtoplevel.ss"))
|
"libtoplevel.ss"))
|
||||||
|
|
||||||
(define (read-file file)
|
(define (read-file file)
|
||||||
(with-input-from-file file
|
(with-input-from-file file
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
@ -39,12 +55,13 @@
|
||||||
(cons x (f))))))))
|
(cons x (f))))))))
|
||||||
|
|
||||||
(define (expand-library-file ifile)
|
(define (expand-library-file ifile)
|
||||||
(map chi-top-library (read-file ifile)))
|
(map boot-library-expand (read-file ifile)))
|
||||||
|
|
||||||
(define (expand-all ls)
|
(define (expand-all ls)
|
||||||
(apply append (map expand-library-file ls)))
|
(apply append (map expand-library-file ls)))
|
||||||
|
|
||||||
(printf "expanding ...\n")
|
(printf "expanding ...\n")
|
||||||
|
|
||||||
(let ([core* (expand-all scheme-library-files)])
|
(let ([core* (expand-all scheme-library-files)])
|
||||||
(printf "compiling ...\n")
|
(printf "compiling ...\n")
|
||||||
(let ([p (open-output-file "ikarus.boot" 'replace)])
|
(let ([p (open-output-file "ikarus.boot" 'replace)])
|
||||||
|
@ -52,6 +69,7 @@
|
||||||
(lambda (x) (compile-core-expr-to-port x p))
|
(lambda (x) (compile-core-expr-to-port x p))
|
||||||
core*)
|
core*)
|
||||||
(close-output-port p)))
|
(close-output-port p)))
|
||||||
|
|
||||||
(printf "Happy Happy Joy Joy\n"))
|
(printf "Happy Happy Joy Joy\n"))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue