Series

How Parsing & Interpreters Works

From Source Text to Execution

Every programming language starts the same way: raw source text goes in, structured meaning comes out. This series follows that journey step by step — breaking text into tokens, parsing tokens into trees, and finally executing those trees directly or compiling them down to bytecode.

By the end, you'll have a clear mental model of every stage in a language's front-end pipeline and the tools to build your own.

How to read this series: Start from the top. Each article feeds into the next — the tokenizer produces tokens for the parser, the parser builds trees for the interpreter, and the interpreter motivates the bytecode VM. Follow along and you'll build up an entire pipeline piece by piece.
  1. 001
    Beginner Tokenizers & Lexers

    Breaking source text into tokens

    3 min
  2. 002
    Beginner Recursive Descent Parsing

    Top-down parsing by hand

    6 min
  3. 003
    Intermediate Pratt Parsing

    Operator precedence made simple

    5 min
  4. 004
    Intermediate AST Construction

    Building and traversing syntax trees

    5 min
  5. 005
    Intermediate Tree-Walking Interpreters

    Evaluating an AST directly

    5 min
  6. 006
    Advanced Bytecode Virtual Machines

    Compiling to and executing bytecode

    7 min

Runtime & Semantics

Variables, closures, types, and memory — the runtime machinery that makes a language feel complete.

  1. 007
    Intermediate Scope & Environments

    How variables find their values

    9 min
  2. 008
    Intermediate Closures & Upvalues

    Capturing variables across scope boundaries

    8 min
  3. 009
    Intermediate Type Checking

    Catching errors before runtime

    8 min
  4. 010
    Advanced Garbage Collection

    Automatic memory management for language runtimes

    10 min

More Parsing Techniques

Beyond recursive descent — alternative approaches to turning text into trees.

  1. 011
    Intermediate Error Recovery

    Parsing past mistakes

    8 min
  2. 012
    Intermediate Parser Combinators

    Building parsers from small composable functions

    8 min
  3. 013
    Intermediate PEG Grammars

    Ordered choice and unlimited lookahead

    10 min
  4. 014
    Advanced LR & LALR Parsing

    Bottom-up parsing with a state machine

    12 min
  5. 015
    Intermediate Precedence Climbing

    An alternative to Pratt parsing

    9 min

Compilation & Optimization

Making generated code faster — from register allocation to just-in-time compilation.

  1. 016
    Advanced Register Allocation

    Mapping variables to finite registers

    9 min
  2. 017
    Advanced Optimization Passes

    Making compiled code faster

    7 min
  3. 018
    Advanced JIT Compilation

    From bytecode to native code at runtime

    11 min

Practical

Putting it all together — REPLs, debugging, and a radically different syntax.

  1. 019
    Intermediate Building a REPL

    Interactive programming, one line at a time

    8 min
  2. 020
    Intermediate Source Maps & Debugging

    Mapping compiled code back to source

    11 min
  3. 021
    Intermediate S-Expressions & Lisp

    When the syntax tree is the syntax

    10 min