I hope you are well! This week we dive into Compilers.
Systems Programming and Compilers#
The mountain of compilation, from Crafting Interpreters.

We start on the bottom left and end on a different node at the bottom of the mountain.
Compiling C for example, results in Machine Code, while Python results in Bytecode.
On the way we do:
Scanning, to convert our code into tokens.
Parsing, to convert our tokens into an Abstract Syntax Tree.
After some optimisation of the tree, we convert the AST to either, another language, bytecode or directly to machine code.
Go Compiler is written in Go?#
I was very surprised when I first heard this. How can one languageβs compiler be written in the same language?
It turns out, this is the case not just for Golang, but also for Java and others.
The secret lies in the first implementation of the compiler.
When the language is first created, the compiler is written in an existing language, eg C. This can be used to compile the new language. Then, a compiler is written in the new language, and compiled with the C compiler.
Now we have a working compiler written in the same language!
The next version of the compiler is compiled using the previous version, and so on.
Interesting stack overflow post discussing this here.
Go moved from a C compiler to a Go compiler in 2013. Some interesting readings on why they did this here.
Just In Time (JIT) Compilation#
A blog post from Mozilla on how JIT works. Our code starts executing, we run some kind of profiler to work out where we are spending the most time, then we compile those parts directly to machine code.
An interesting discussion here on why you might choose to not use JIT.
Oxide Computer#
Oxide Compute was recently announced as generally available. Some big names in Computer Science are behind this initiative, will be very interesting to see where this goes.
The key idea for this company is that you should be able to buy cloud resources, not just rent them.
I Love Go; I Hate Go#
Interesting article about the pros and cons of Go. Personally, I enjoy Go and think itβs excellent!
Zero Allocation Protobuf Parsing in Go#
Molecule is a Go library for parsing protobufs in an efficient and zero-allocation manner
Pretty interesting stuff! Looks like this makes sense when you need to unpack only a subset of fields from a large proto message.
On Trusting Trust#
The 40th anniversary of the original paper, this is an interesting discussion on how to create a compiler to do nasty things to your code.
Also, this Numberphile video.
End#
Thatβs all for this week, expect to see learnings on systems programming and compilers next week!