BrainRot Lang
A Fully Interpreted Programming Language, Built From Scratch.
Project
Compiled Language + Full Dev Toolchain
Role
Language Designer & Compiler Engineer
Company
Personal Project
Core Language
Toolchain & Distribution
Editor & Docs

Most developers write code every single day without ever stopping to wonder what actually happens between the moment they hit "run" and the moment something appears on screen. I wanted to know. Not from a textbook — by building it myself.
THE IDEA 💡
What if learning compilers was actually fun?
This started as a course requirement and turned into something I genuinely couldn't stop working on. The premise was simple: instead of writing yet another toy language with boring keywords, every reserved word would be a real internet meme. trust_me_bro for variables. chat_is_this_real for if-statements. let_him_cook for functions. mission_abort for break.
The meme angle wasn't just for laughs though — it forced me to design a language spec from scratch. I couldn't borrow keywords from Python or C and call it done. Every construct had to be deliberately invented, then lexed, parsed, and evaluated. That constraint turned out to be the best learning tool I could have given myself.
THE PROBLEM 🎯
Building a language is more layered than it looks
The tricky part isn't any one phase of the compiler — it's that all four phases have to work together without breaking each other. A decision you make in the lexer has consequences in the parser. A gap in the AST node types only shows up as a cryptic crash three layers deep in the interpreter. Things like operator precedence, closure scope, and error recovery are well-understood in theory but genuinely hard to get right in practice.
Beyond just the language itself, I also wanted to actually ship it. A GitHub repo with a .go file felt like half the project. I wanted a real VS Code extension that highlights syntax, a documentation site someone could actually learn from, and a release pipeline that automatically builds and distributes binaries — the same way real open-source tools do.
THE SOLUTION 🚀
A complete language with a real toolchain around it
BrainRot Lang implements all four phases of a compiler from scratch. The lexer uses a DFA-based scanner with two-pointer input buffering, so it can look ahead one character to distinguish == from = or += from +. The parser is a recursive descent implementation that builds a typed AST with over 20 node types, collecting all syntax errors before stopping rather than crashing at the first one — which is how professional compilers like Go and GCC handle it. The interpreter walks the AST, supports closures with proper scope chain isolation, first-class functions, arrays, and compound assignment. All 19 automated tests pass.
Complete Four-Phase Compiler Pipeline
Lexer → Parser → AST → tree-walking Interpreter, all built from scratch in Go. No libraries doing the heavy lifting — every token, every node, every scope chain is hand-written.
Full Language Feature Set
Variables, conditionals with else-if chains, for and while loops, functions, recursion, closures, first-class functions, arrays, and compound operators — plus proper error recovery that reports all errors at once.
VS Code Extension on the Marketplace
Syntax highlighting for every keyword, Tab-expandable code snippets, auto-closing brackets, and a custom .brt file icon. Published and installable from the VS Code Marketplace right now.
Full Documentation Site
A Next.js docs site on Vercel covering quickstart, syntax rules, keyword reference, type system, formal grammar, AST node reference, CLI commands, installation guides, and worked examples.
Automated Cross-Platform Release Pipeline
GitHub Actions builds and publishes binaries for four platforms on every release tag — Windows, Mac Intel, Mac ARM, and Linux. Zero manual steps — push the tag, the binaries appear.
ARCHITECTURE 🏗️
How source code becomes output — four distinct phases
The pipeline is straightforward once you understand what each phase is responsible for. Raw source code enters the lexer, which reads it character by character and converts it into a flat list of tokens — think of tokens as the individual "words" of the program.
The parser then reads those tokens and builds an Abstract Syntax Tree, which is a structured tree that captures not just what the tokens are but how they relate to each other — that chat_is_this_real has a condition and a body, that run_it_back has an initializer, a test, and an update step.
Finally, the interpreter walks that tree and executes each node directly, maintaining an environment of variable names and their values, with each function call creating a new child scope that can see everything in its parent.
Source → Lexer → Parser → Interpreter → Output
SOURCE
.brt file
raw input
LEXER
DFA scanner
2-ptr buffering
PARSER
Recursive Descent
20+ node types
INTERPRETER
Tree-walking
Scope chains
OUTPUT
stdout / return
Project Gallery
A visual walkthrough of the interface and key screens.


