I built my own programming language from scratch (and it took me 2 months)
Ever since I started learning to code, I had one dream that always felt
too big: what if I built my own programming language?
Not a toy. Not a calculator. A real language — with variables, functions,
classes, error handling, and its own package manager.
So I did it. And it only took me about 2 months.
What is Luz?
Luz (the Spanish word for light) is a lightweight interpreted
programming language written in Python. It's designed to be simple,
readable, and easy to learn.
This is valid Luz code:
name = listen("What is your name? ")
write($"Hello {name}!")
for i = 1 to 5 {
if even(i) {
write($"{i} is even")
} else {
write($"{i} is odd")
}
}
It has:
- Dynamic typing
- Format strings —
$"Hello {name}!" - Classes and inheritance
- Lambdas —
fn(x) => x * 2 - Error handling —
attempt / rescue - A module system —
import "utils.luz" - A package manager called Ray
- A standalone Windows installer (no Python required)
- Full documentation website
I'm just a student
I want to be upfront about this: I'm not a professional developer.
I'm a student who learned programming and decided to push myself further
than any tutorial ever asked me to.
Building Luz taught me more than any course I've taken:
- How a lexer turns raw text into tokens
- How a recursive descent parser builds an AST
- How an interpreter walks a tree and executes code
- How closures actually work under the hood
- How OOP can be implemented from scratch
If you've ever been curious about how programming languages work,
building one — even a small one — is the best way to find out.
The hardest parts
Operator precedence was the first real challenge. Getting 2 + 3 * 4
to evaluate correctly requires a specific structure in the parser. Once
it clicked, it felt like magic.
OOP was the most complex feature. Implementing super, closures,
and method resolution took the most time and debugging.
The dot operator caused a sneaky bug — the lexer was consuming obj.attr
as a float literal. A small lookahead fix solved it, but it took a while
to find.
What's next
Luz is heading toward web development — HTTP servers, JSON, fetch,
and eventually a full-stack story. The goal is to make Luz the simplest
language for building web things.
The package manager Ray is also growing. Soon you'll be able to install
community libraries with:
ray install user/package
Try it
- Website & docs: https://elabsurdo984.github.io/luz-lang/
- GitHub: https://github.com/Elabsurdo984/luz-lang
- Windows installer: available on the website
I'd love to hear what you think — feedback, criticism, ideas.
This project is still young and I'm learning as I go.
If you've ever thought about building your own language, do it.
It's the most fun I've had coding.
Top comments (0)