From Source Code To Machine Code EBook·Paperback
⟵ prev Contents next ⟶

🔥 My other Book: Build Your Own Redis

From Source Code To Machine Code

Build Your Own Compiler From Scratch

James Smith


Ever wondered how computers turn source code into working software? You can learn the art by building your own mini-compiler.

A succinct book walks through a minimal yet complete compiler implementation. Compiles a static-typed language into x64 ELF executables.


Part I: Interpreter

  1. Introduction
  2. A Simple Calculator
  3. Interpreter: Variables and Scopes
  4. Interpreter: Control Flows and Functions

Part II: Bytecode Compiler

  1. How Computers Work
  2. The Virtual Machine and Bytecode
  3. Compiler: Variables and Expressions
  4. Compiler: Control Flows
  5. Compiler: Functions and Non-Local Variables

Part III: Machine Code

  1. A Crash Course on x64 Assembly
  2. The x64 Instruction Encoding
  3. From Virtual Machine to Real Machine
  4. Binary Executables
  5. Pointers and Memory

The book is available for purchase.

See also: offers “Build Your Own X” courses in many programming languages.
Including Redis, Git, SQLite, Docker, and more.
Check it out

⟵ prev Contents next ⟶