A statically-typed programming language and tree-walking interpreter built from scratch in Go.
MonoLang is a personal systems programming project focused on understanding how programming languages work internally. Instead of relying on parser generators or compiler frameworks, every stage of the language is being implemented manually—from lexical analysis to parsing, evaluation, and type checking.
The goal of this project is to gain a deeper understanding of compiler construction, language design, and runtime systems.
Interactive Playground: mono.monotake.com
🚧 Active Development
- Character Streaming & Position Tracking
- Tokenizing Identifiers, Digits, & Symbols (=, +, -, !, *, /, ;, ==, !=)
- Keyword Recognition (let, return, fn, true, false, if, else)
- Abstract Syntax Tree (AST) Base Architecture
- Statement Rules:
letandreturnstatements - Primitive Expressions: Identifiers, Integer Literals, Boolean Primitives
- Prefix Operators:
-xand!x - Infix Operators:
+,-,*,/,==,!= - Precedence Override: Grouped Parentheses
(x + y) - Control Flow Blocks:
if / elseconditionals - Functional Syntax: Function definitions
fn(x) {}and call expressionsadd(x)
- Object System: Creating internal wrappers for Integers, Booleans, and Functions
- Tree-Walking Evaluation: Writing the core
Eval(node AST)runner - Environment Management: Building a hash map memory store for variables
- Function Stack: Handling scope, arguments, and return unwinding
- Wasm Interop Bridge: Building a dedicated execution gateway using Go's
syscall/jslayer. - Browser Compilation: Compiling the core engine into a client-side binary footprint (
GOOS=js GOARCH=wasm). - Interactive IDE Interface: Crafting a highly responsive, polished React/Next.js playground panel featuring text workspaces and a virtual output terminal console.
- Automated CI/CD Delivery: Building a GitHub Actions pull-based pipeline with a self-hosted runner to automatically build, extract runtime gluings, and update static assets on push.
- Edge Network Optimization: Configuring Cloudflare Zero Trust secure paths and Nginx compression metrics (
gzip_types application/wasm) for high-velocity edge stream execution.
Programming languages are often treated as black boxes.
MonoLang is an attempt to understand every layer involved in language implementation by building each component from first principles.
Rather than focusing on performance, this project prioritizes readability, correctness, and learning.
monolang/
├── go.mod
├── main.go
├── token/
│ └── token.go
├── lexer/
│ └── lexer.go
├── ast/
│ └── ast.go
├── parser/
│ └── parser.go
├── object/
│ └── object.go
├── evaluator/
│ └── evaluator.go
└── LICENSE
Note: The repository structure will evolve as additional compiler stages are implemented.
- Language: Go
- Development Platform: Linux Core Systems / Darwin (macOS)
- Testing Infrastructure: Native Go Unit Testing Framework
This project draws inspiration from several excellent resources on compiler and interpreter construction, while being implemented independently as a learning exercise.
- Writing an Interpreter in Go — Thorsten Ball
- Crafting Interpreters — Robert Nystrom
- Compilers: Principles, Techniques, and Tools ("Dragon Book")
BSD 3-Clause License