The first compiler I ever worked on was the one I wrote in the spring of 2009 for Kent Dybvig’s graduate compilers course at Indiana University. Actually, I didn’t write just one compiler for Kent’s course that semester; I wrote fifteen compilers, one for each week of the course. The first one had an input language that was more or less just parenthesized assembly language; its target language was x86-64 assembly. Each week, we added more passes to the front of the previous week’s compiler, resulting in a new compiler with the same target language as the compiler of the previous week, but a slightly higher-level input language.
—"My first fifteen compilers" by Lindsey Kuper.
A compiler is a program that translates code from one language to another.
Let's create a compiler that translates a made-up programming language down to x86-64 assembly. We'll do it in small steps, starting at the very end: generating x86-64 assembly that our computer can actually run.
-
...more to come...
Contribute your solution by creating a directory in this repo such as bryan_hunter+elixir
.
Compiler Explorer is handy for answering the question "How can I do X in assembly?" as long as you know how to do X in some compiled language, like C, C++, Rust, or Go.