Skip to content

Commit 3538829

Browse files
committed
crook
1 parent 7e28347 commit 3538829

File tree

5 files changed

+38
-1
lines changed

5 files changed

+38
-1
lines changed

iniquity-plus/compile-ops.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#lang racket
2-
(provide compile-op0 compile-op1 compile-op2 compile-op3 pad-stack)
2+
(provide compile-op0 compile-op1 compile-op2 compile-op3 pad-stack assert-cons)
33
(require "ast.rkt")
44
(require "types.rkt")
55
(require a86/ast)

iniquity-plus/compile-stdin.rkt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#lang racket
2+
(provide main)
3+
(require "parse.rkt")
4+
(require "compile.rkt")
5+
(require "read-all.rkt")
6+
(require a86/printer)
7+
8+
;; -> Void
9+
;; Compile contents of stdin,
10+
;; emit asm code on stdout
11+
(define (main)
12+
(read-line) ; ignore #lang racket line
13+
(asm-display (compile (apply parse (read-all)))))
14+

iniquity-plus/compile.rkt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@
172172
(seq (Lea rax r)
173173
(Push rax)
174174
(compile-es es (cons #f c))
175+
;; TODO: communicate argument count to called function
175176
(Jmp (symbol->label f))
176177
(Label r))))
177178

iniquity-plus/interp-stdin.rkt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#lang racket
2+
(provide main)
3+
(require "parse.rkt")
4+
(require "interp.rkt")
5+
(require "read-all.rkt")
6+
7+
;; -> Void
8+
;; Parse and interpret contents of stdin,
9+
;; print result on stdout
10+
(define (main)
11+
(read-line) ; ignore #lang racket line
12+
(println (interp (apply parse (read-all)))))
13+

iniquity-plus/read-all.rkt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#lang racket
2+
(provide read-all)
3+
;; read all s-expression until eof
4+
(define (read-all)
5+
(let ((r (read)))
6+
(if (eof-object? r)
7+
'()
8+
(cons r (read-all)))))
9+

0 commit comments

Comments
 (0)