back

Words

Thoughts on code, music, and everything in between.

Source code to AST diagram

Making a Programming Language

A step-by-step guide to building your own programming language in TypeScript — covering lexing, parsing, evaluation, variables, math, arrays, and more.

May 18, 2026#typescript#compilers
Source code being split into tokens

Making a Language: The Lexer

Building the lexer for Spark — turning source code into tokens with line/column tracking, comments, and escape sequences.

May 18, 2026#typescript#compilers
Token stream being parsed into an AST

Making a Language: The Parser

Building a recursive descent parser with precedence climbing for Spark's expressions, statements, and control flow.

May 18, 2026#typescript#compilers
AST nodes being evaluated

Making a Language: The Evaluator

Building Spark's evaluator — environments, closures, operator overloading, return signals, and error reporting.

May 18, 2026#typescript#compilers
Spark code in a playground

Making a Language: Using Spark

Tying everything together — the run function, complete Spark examples, and exercises for extending the language.

May 18, 2026#typescript#compilers