No description
Find a file
2026-01-09 16:10:48 -05:00
.gitignore Add top-level test file 2025-12-20 19:31:52 -05:00
anf.rkt Refactor codegen to produce blocks 2026-01-09 16:10:48 -05:00
asm.rkt Refactor codegen to produce blocks 2026-01-09 16:10:48 -05:00
cvar-syntax.rkt Fix all the test cases 2025-12-16 14:06:09 -05:00
cvar-to-x86.rkt Refactor codegen to produce blocks 2026-01-09 16:10:48 -05:00
driver.rkt Refactor codegen to produce blocks 2026-01-09 16:10:48 -05:00
effects.rkt Refactor codegen to produce blocks 2026-01-09 16:10:48 -05:00
graph.rkt Add top-level test file 2025-12-20 19:31:52 -05:00
interp.rkt Extend the interpreter to handle ifs 2025-12-20 20:26:14 -05:00
liveness-test.rkt Add top-level test file 2025-12-20 19:31:52 -05:00
liveness.rkt Add top-level test file 2025-12-20 19:31:52 -05:00
notes.md Fix the buggy patch-instructions function and add documentation 2025-12-15 20:37:00 -05:00
parse.rkt Extend the interpreter to handle ifs 2025-12-20 20:26:14 -05:00
print-x86.rkt Refactor codegen to produce blocks 2026-01-09 16:10:48 -05:00
README.org Update the README 2025-12-16 16:29:17 -05:00
runtime.c Add driver code for testing 2025-12-17 16:53:25 -05:00
syntax.rkt Extend the interpreter to handle ifs 2025-12-20 20:26:14 -05:00
test-arith.scm Add test source files 2025-12-16 16:18:01 -05:00
test-overall.rkt Refactor codegen to produce blocks 2026-01-09 16:10:48 -05:00
test-read.scm Add top-level test file 2025-12-20 19:31:52 -05:00
test.rkt Generalize code to handle multiple blocks (wip) 2026-01-08 15:24:43 -05:00
test.S Fix the buggy patch-instructions function and add documentation 2025-12-15 20:37:00 -05:00
uniquify.rkt Add driver code for testing 2025-12-17 16:53:25 -05:00

A simple compiler to x86

Using delimited continuations in various awful ways to implement a compiler that targets x86.

The implementation is based on the book Essentials of Compilation, although I wrote all the infrastructure code from scratch instead of just filling in the blanks.

Compiling and running the generated assembly code

# produce x86 assembly from the source code
racket driver.rkt test-arith.scm
# compile the runtime
gcc -c runtime.c
# compile the assembly
gcc -c test-arith.S
# link everything together
gcc test-arith.o runtime.o -o test-arith

The compiler currently only produces a single function named arith which takes no input and returns an integer.