From c441f8f092cd5da5b09e3e4e826141d915189ab5 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 10 Aug 2022 18:12:44 -0400 Subject: Step 1: Integers --- compiler.scm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 compiler.scm (limited to 'compiler.scm') diff --git a/compiler.scm b/compiler.scm new file mode 100644 index 0000000..1285ac6 --- /dev/null +++ b/compiler.scm @@ -0,0 +1,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")))) -- cgit v1.2.3