Programming languages resources

This page is a collection of my favorite resources for people getting started writing programming languages. I hope to keep it updated as long as I continue to find great stuff.

I made a fun compilers t-shirt and also a fun JIT compilers t-shirt

Compilers

Lisp specific

Runtimes

Runtime optimization

Here are some resources I have found useful for understanding the ideas and research around optimizing dynamic languages.

And here are runtime optimization resources that I wrote!

Pointer tagging and NaN boxing

Resources on representing small values efficiently.

Just-In-Time compilers

Small JITs to help understand the basics. Note that these implementations tend to focus on the compiling ASTs or IRs to machine code, rather than the parts of the JIT that offer the most performance: inline caching and code inlining. Compiling is great but unless you’re producing good machine code, it may not do a whole lot.

Assembler libraries

Sometimes you want to generate assembly from a host language. Common use cases include compilers, both ahead-of-time and just-in-time. Here are some libraries that can help with that.

For more inspiration, check out some of the assemblers in runtimes I mention in my Compiling a Lisp post.

Little low-level JIT IR libraries

Things I want to write about

I have not written much about runtime optimization yet, but I would like to write about:

Papers I want to read

SystemV ABI

This is mostly a reminder for myself because I can never remember the order of registers. Sourced from the AMD64 ABI Draft 1.0 (PDF).

Caller-saved: rax, rcx, rdx, rsi, rdi, r8-r11, xmm0-xmm15.

Callee-saved: rbx, rsp, rbp, r12-r15.

For integers

Return values in rax and rdx.

Parameter Register
1 rdi
2 rsi
3 rdx
4 rcx
5 r8
6 r9

Once registers are assigned, the arguments passed in memory are pushed on the stack in reversed (right-to-left) order

For doubles

Return values in xmm0 and xmm1.

Parameter Register
1 xmm0
2 xmm1
3 xmm2
4 xmm3
5 xmm4
6 xmm5
7 xmm6
8 xmm7

Interesting tools

This is a sort of grab-bag for helpful or interesting tools for programming language implementation.

(wow, this is turning into a Justine Section)

Build tools

Right now this is probably going to just be a section on Ninja clones.

Game Boy Emulators

This is a potentially fun way to render the screen without SDL, but only for non-interactive purposes.

This YouTube playlist looks like it could be worth a watch, but it’s a lot of hours.

Lists

I should probably pick and choose some great stuff from these lists to copy onto this page.

Communities