Implement till 5.39
This commit is contained in:
@@ -1,6 +1,28 @@
|
||||
(load "util.scm")
|
||||
(load "misc/sicp-compiler.scm")
|
||||
|
||||
(define (compile-to-file code target linkage file-name)
|
||||
(set! label-counter 0)
|
||||
(define (write-list-to-port xs port)
|
||||
(if (null? xs)
|
||||
'()
|
||||
(begin
|
||||
(display (car xs) port)
|
||||
(display "\n" port)
|
||||
(write-list-to-port (cdr xs) port))))
|
||||
(if #f ; #t means write to file; #f means don't write to file
|
||||
(let* ((compile-result (compile code target linkage))
|
||||
(assembly-insts (statements compile-result))
|
||||
(port (open-output-file file-name)))
|
||||
(write-list-to-port assembly-insts port)
|
||||
(display "[")
|
||||
(display file-name)
|
||||
(display "]\n")
|
||||
(close-output-port port))
|
||||
(begin
|
||||
(display "[")
|
||||
(display file-name)
|
||||
(display "]\n"))))
|
||||
|
||||
(display "\nex-5.31 - save-and-restore-for-apply\n")
|
||||
|
||||
; 1. save and restore env around operator
|
||||
|
||||
Reference in New Issue
Block a user