No description
| .gitignore | ||
| anf.rkt | ||
| asm.rkt | ||
| cvar-syntax.rkt | ||
| cvar-to-x86.rkt | ||
| driver.rkt | ||
| effects.rkt | ||
| graph.rkt | ||
| interp.rkt | ||
| liveness-test.rkt | ||
| liveness.rkt | ||
| notes.md | ||
| parse.rkt | ||
| print-x86.rkt | ||
| README.org | ||
| runtime.c | ||
| syntax.rkt | ||
| test-arith.scm | ||
| test-overall.rkt | ||
| test-read.scm | ||
| test.rkt | ||
| test.S | ||
| uniquify.rkt | ||
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.