-
Notifications
You must be signed in to change notification settings - Fork 0
/
interp-boot.scm
51 lines (43 loc) · 1.25 KB
/
interp-boot.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
(set! list (lambda x x))
(load "interp-preprocess.scm")
(load "interp-kernel.scm")
(load "lib/scheme-libs.scm")
(define (preprocess inp out)
(let ((op (open-output-file out)))
(map (lambda (e) (writeln e op))
(cdr (uniquify-program (cons 'begin (read-sexps-from-path inp)))))
(close-port op)))
(system "mkdir -p preprocess")
(system "mkdir -p preprocess/lib")
(if (file-exists? "preprocess/interp-preprocess.scm")
#t
(begin
(preprocess "interp-preprocess.scm" "preprocess/interp-preprocess.scm")
(preprocess "interp-kernel.scm" "preprocess/interp-kernel.scm")))
(define compiler-path "scheme-compiler")
(load "preprocess/interp-preprocess.scm")
(load "preprocess/interp-kernel.scm")
(define (for-each f xs)
(if (pair? xs)
(begin
(f (car xs))
(for-each f (cdr xs)))
'()))
(define files '(
"lib/scheme-libs.scm"
"lib/reader.scm"
"lib/writer.scm"
"lib/match-defmacro.scm"
"lib/set.scm"
"lib/utils.scm"
))
(define (preprocess* name)
(preprocess (string-append compiler-path "/" name)
(string-append "preprocess/" name)))
(for-each
(lambda (name)
(preprocess* name)
(load (string-append "preprocess/" name)))
files)
(preprocess* "front.scm")
(preprocess* "compiler.scm")