diff options
Diffstat (limited to 'csc/compiler.csc')
| -rw-r--r-- | csc/compiler.csc | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/csc/compiler.csc b/csc/compiler.csc index 6bdf1ba..ee0b3b4 100644 --- a/csc/compiler.csc +++ b/csc/compiler.csc @@ -4,7 +4,10 @@ compile) (import (scheme base) (only (scheme file) + call-with-input-file file-exists?) + (only (scheme read) + read) (only (csc codegen) ir2->ir3) (only (csc config) @@ -17,16 +20,32 @@ (only (csc format) sprintf) (only (csc hash-map) + compare-symbols hash-bytevector + insert + key-not-found-error? + lookup make-comparer make-map merge) + (only (csc ir1) + %define-syntax + %library-define + %library-ref + %sequence) (only (csc linker) link) (only (csc list) revappend) + (only (csc loop) + loop + return) + (only (csc macros) + expand-body) (only (csc match) - match)) + match) + (only (csc strings) + join)) (begin @@ -80,7 +99,7 @@ (define (ir1->bytecode expr) - (ir2->ir3 (closure-convert (ir1->ir2 expr)))) + (ir2->ir3 (closure-convert (ir1->ir2 expr (lambda (x) *tail*))))) ; compile turns scheme code into bytecode. @@ -104,8 +123,10 @@ ('import . imports) ('begin . body)) + (define expanded-body (expand-body library-name body env)) + (define env (make-import-map imports)) - (let loop ((expr (expand-body library-name body env))) + (let loop ((expr expanded-body)) (match expr ((% %library-define (% %library-ref name _) val) (set! env (insert env name val))) |
