Ptolemy Lang
A complete costum programming language interpreter built from scratch in Go — covering lexing, parsing, AST construction, evaluation, closures, and lexical scoping.
Problem
Ptolemy is a custom programming language written in Go, featuring JavaScript-like syntax and designed for educational purposes and personal coding experimentation.
Prior Art
Ptolemy is inspired by JavaScript, adopting a familiar syntax while exploring the fundamentals of interpreter design and execution in Go
Design Decisions
Ptolemy uses JavaScript-like syntax for familiarity and focuses on implementing core interpreter components (lexer, parser, AST, execution) rather than being feature-complete. It is built in Go for simplicity and clarity.
Architecture
Ptolemy is structured around the core stages of language execution: lexing, parsing, AST construction, and interpretation. Each stage is separated to keep the implementation clear, modular, and easy to extend..
Reflection
Building Ptolemy provided hands-on insight into how programming languages work under the hood, from parsing to execution. It highlighted the importance of clear structure, simplicity, and the trade-offs involved in language design.