diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/csc/compiler.csc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/csc/compiler.csc b/lib/csc/compiler.csc index e2e682e..ee6ca0f 100644 --- a/lib/csc/compiler.csc +++ b/lib/csc/compiler.csc @@ -3,7 +3,6 @@ add-library-search-dirs compile) (import (scheme base) - (csc format) (only (scheme file) call-with-input-file file-exists?) @@ -33,7 +32,8 @@ %define-syntax %library-define %library-ref - %sequence) + %sequence + library-ref-name) (only (csc ir2) *tail*) (only (csc linker) @@ -132,9 +132,7 @@ (define (ir1->bytecode expr) (define c (closure-convert (ir1->ir2 expr (lambda (x) *tail*)))) - (printf "ir2 =\n{}\n" c) (define b (ir2->ir3 c)) - (printf "ir3 =\n{}\n" b) b) @@ -161,8 +159,8 @@ (let loop ((expr expanded-body)) (match expr - ((% %library-define (% %library-ref name _) val) - (set! env (insert env name val))) + ((% %library-define ref _) + (set! env (insert env (library-ref-name ref) ref))) ((% %define-syntax name val) (set! env (insert env name val))) ((% %sequence head tail) @@ -199,7 +197,6 @@ ((('import . imports1) ('import . imports2) . rest) (compile (cons (cons 'import (append imports1 imports2)) rest))) ((('import . imports) . body) - (printf "imports {}\n" imports) (define compiled-body (ir1->bytecode (expand-body 'main body (make-import-map imports)))) (encode (link (revappend library-code (list compiled-body (list (list 'exit (list 'const 0)))))))) (_ (error "unexpected form in compile" program)))))) |
