|
|
@ -1,17 +1,12 @@
|
|
1
|
|
(define (emit1 instr arg)
|
|
|
1
|
(define (emit instr . args)
|
|
2
|
2
|
(display "\t")
|
|
3
|
|
(display (format instr arg))
|
|
4
|
|
(display "\n"))
|
|
5
|
|
|
|
6
|
|
(define (emit0 instr)
|
|
7
|
|
(display "\t")
|
|
8
|
|
(display instr)
|
|
|
3
|
(display (apply format instr args))
|
|
9
|
4
|
(display "\n"))
|
|
10
|
5
|
|
|
11
|
6
|
(define (compile-program x)
|
|
12
|
7
|
(display "\t.globl scheme_entry\n\n")
|
|
13
|
8
|
(display "scheme_entry:\n")
|
|
14
|
|
(emit1 "movl $~a, %eax" x)
|
|
15
|
|
(emit0 "ret"))
|
|
|
9
|
(emit "movl $~a, %eax" x)
|
|
|
10
|
(emit "ret"))
|
|
16
|
11
|
|
|
17
|
12
|
(compile-program 42)
|