Skip to content

Commit c0fcf69

Browse files
committed
compile-file for loot.
1 parent bedefe7 commit c0fcf69

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

www/notes/loot/compile-file.rkt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#lang racket
2+
(provide (all-defined-out))
3+
(require "compile.rkt" #;"syntax.rkt" "asm/printer.rkt")
4+
5+
;; String -> Void
6+
;; Compile contents of given file name,
7+
;; emit asm code on stdout
8+
(define (main fn)
9+
(with-input-from-file fn
10+
(λ ()
11+
(let ((p (read-program)))
12+
; assumed OK for now
13+
;(unless (and (prog? p) (closed? p))
14+
; (error "syntax error"))
15+
(asm-display (compile p))))))
16+
17+
(define (read-program)
18+
(regexp-match "^#lang racket" (current-input-port))
19+
(read))

0 commit comments

Comments
 (0)