Compilers are a fascinating topic. You use them every day. They turn your textual source code into some binary magic executed by computers. It is ofte

The “From Source Code to Machine Code” book is finished

submited by
Style Pass
2023-05-24 13:00:03

Compilers are a fascinating topic. You use them every day. They turn your textual source code into some binary magic executed by computers.

It is often said that learning C leads to a better understanding of computers. What’s even better than just learning C is learning compilers and assembly, because even after learning C, the machine and the compiler may still seem like black boxes to you.

Compiler construction is a subject included in computer science and software engineering education. However, many of today’s (2023+) coders do not have a formal CS education. Basic things such as compilers, databases, operating systems, etc. are often seen as magical black boxes. That’s why I started the “Build Your Own X” book series. To learn and teach basic things by the “from scratch” approach, through succinct & condensed books.

The first step to my compiler is a simple interpreter, which is a Python script that executes an S-expression (sexpr). It has variables, control flows, and functions, which is sufficient to write programs in. The syntax looks like this:

Leave a Comment