changed compile-expr to expand first

This commit is contained in:
Abdulaziz Ghuloum 2006-12-06 21:20:15 -05:00
parent cd4eef2382
commit 5abcbccb3a
3 changed files with 15 additions and 4 deletions

Binary file not shown.

View File

@ -243,6 +243,8 @@
(define (unique-var x) (define (unique-var x)
(make-var (gensym x) #f #f)) (make-var (gensym x) #f #f))
(define (recordize x) (define (recordize x)
(define (gen-fml* fml*) (define (gen-fml* fml*)
(cond (cond
@ -4597,7 +4599,8 @@
)))) ))))
(define (compile-expr expr) (define (compile-expr expr)
(let* ([p (recordize expr)] (let* ([p (expand expr)]
[p (recordize p)]
[p (optimize-direct-calls p)] [p (optimize-direct-calls p)]
[p (optimize-letrec p)] [p (optimize-letrec p)]
[p (uncover-assigned/referenced p)] [p (uncover-assigned/referenced p)]
@ -4635,7 +4638,7 @@
(let f () (let f ()
(let ([x (read ip)]) (let ([x (read ip)])
(unless (eof-object? x) (unless (eof-object? x)
(fasl-write (compile-expr (expand x)) op) (fasl-write (compile-expr x) op)
(f)))) (f))))
(close-input-port ip) (close-input-port ip)
(close-output-port op)))) (close-output-port op))))
@ -4644,7 +4647,7 @@
(primitive-set! 'assembler-output (make-parameter #f)) (primitive-set! 'assembler-output (make-parameter #f))
(primitive-set! 'compile (primitive-set! 'compile
(lambda (x) (lambda (x)
(let ([code (compile-expr (expand x))]) (let ([code (compile-expr x)])
(let ([proc ($code->closure code)]) (let ([proc ($code->closure code)])
(proc))))) (proc)))))

View File

@ -231,6 +231,14 @@
)) ))
(define (expand-file ifile)
(with-input-from-file ifile
(lambda ()
(let f ()
(let ([x (read)])
(unless (eof-object? x)
(sc-expand x)
(f)))))))
(define (compile-library ifile ofile) (define (compile-library ifile ofile)
(parameterize ([assembler-output #f] (parameterize ([assembler-output #f]
@ -238,6 +246,7 @@
[interaction-environment system-env]) [interaction-environment system-env])
(printf "compiling ~a ... " ifile) (printf "compiling ~a ... " ifile)
(compile-file ifile ofile 'replace) (compile-file ifile ofile 'replace)
;(expand-file ifile)
(newline))) (newline)))
(for-each (for-each
@ -246,7 +255,6 @@
(compile-library (car x) (caddr x)))) (compile-library (car x) (caddr x))))
scheme-library-files) scheme-library-files)
(define (join s ls) (define (join s ls)
(cond (cond
[(null? ls) ""] [(null? ls) ""]