projects
/
scheme.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Move utils into its onw file
[scheme.git]
/
main.scm
diff --git
a/main.scm
b/main.scm
old mode 100644
(file)
new mode 100755
(executable)
index
e2e96b8
..
e6ac821
--- a/
main.scm
+++ b/
main.scm
@@
-1,3
+1,5
@@
+#!/usr/bin/scheme --script
+
(load "codegen.scm")
(load "platform.scm")
(load "codegen.scm")
(load "platform.scm")
@@
-10,8
+12,8
@@
(or (equal? (car x) "-t")
(equal? (car x) "--target"))
(case (cadr x)
(or (equal? (car x) "-t")
(equal? (car x) "--target"))
(case (cadr x)
- (
"darwin"
'darwin)
- (
"linux"
'linux)
+ (
("darwin")
'darwin)
+ (
("linux")
'linux)
(else (error #f "unknown os")))
(parse-os (cdr x)))))
(define (parse-file x)
(else (error #f "unknown os")))
(parse-os (cdr x)))))
(define (parse-file x)
@@
-28,8
+30,15
@@
(define target (car (parse-args)))
(define file (cadr (parse-args)))
(define target (car (parse-args)))
(define file (cadr (parse-args)))
+ ; reads in all datums until eof
+(define (read-prog port)
+ (let ([x (read port)])
+ (if (eof-object? x)
+ '()
+ (cons x (read-prog port)))))
+
(compile-to-binary
(if (eqv? file 'stdin)
(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)
"a.out" target)