(load "codegen.scm")
+(load "platform.scm")
; returns (os filename)
(define (parse-args)
(define (parse-os x)
- (if (null? x) 'darwin ; todo: replace this with the os
+ (if (null? x) host-os ; todo: replace this with the os
; it was compiled with
(if
(or (equal? (car x) "-t")
(define target (car (parse-args)))
(define file (cadr (parse-args)))
+(define (read-prog port)
+ (if (port-input-empty? port)
+ '()
+ (cons (read) (read-prog port))))
+
(compile-to-binary
(if (eqv? file 'stdin)
- (read)
- (call-with-input-file file read))
+ (read-prog (current-input-port))
+ (call-with-input-file file read-prog))
"a.out" target)