summaryrefslogtreecommitdiff
path: root/compiler.scm
blob: 1285ac65eddda103874b59515df08c72c53ee3c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
(use-modules (ice-9 format))

(define (emit template-string . args)
  (apply format #t template-string args)
  (newline))

(define (compile-program x)
  (with-output-to-file "scheme_entry.S"
    (lambda ()
      (display ".text
.p2align 4
.globl	scheme_entry
.type	scheme_entry, @function
scheme_entry:
")
      (emit "movl $~a, %eax" x)
      (emit "ret"))))