DEV Community

Yogesh Taparia
Yogesh Taparia

Posted on

How I Built and Published My Own Programming Language, YO

As a Computer Science student, I noticed that most projects revolve around web applications, CRUD systems, or mobile apps. While those projects are valuable, I wanted to challenge myself with something that would deepen my understanding of how programming languages actually work under the hood.

That led me to build YO, a custom interpreted programming language written entirely in Python.

The Motivation

Whenever we write code in Python, Java, or C++, we rarely think about what happens after pressing Run.

Questions like these motivated me:

  • How does a programming language understand text?
  • How does it recognize variables and keywords?
  • How are loops and conditions executed?
  • How does source code become something the computer can understand?

Instead of only reading about compilers and interpreters, I decided to build one.

What is YO?

YO is a custom interpreted programming language that allows users to write programs using its own syntax and execute them through a Python-based interpreter.

The project includes:

  • Lexer
  • Parser
  • Runtime Environment
  • Error Handling System
  • Standard Library Modules
  • Test Programs
  • PyPI Package
  • GitHub Repository

How It Works

The execution pipeline follows these stages:

1. Lexical Analysis

The lexer reads source code and converts it into tokens.

Example:

let age = 22
print(age)
Enter fullscreen mode Exit fullscreen mode

Tokens:

LET
IDENTIFIER(age)
EQUALS
NUMBER(22)
PRINT
IDENTIFIER(age)
Enter fullscreen mode Exit fullscreen mode
  1. Parsing

The parser transforms tokens into an Abstract Syntax Tree (AST).

The AST provides a structured representation of the program that can later be executed by the interpreter.

  1. Interpretation

The interpreter walks through the AST and performs operations such as:

  • Variable assignments
  • Arithmetic operations
  • Conditions
  • Loops
  • Function execution (planned)

Features

Current features include:

  • Variables
  • Arithmetic expressions
  • Conditional statements
  • Loops
  • Error reporting
  • Standard library support

Example:

let x = 10

if x > 5
    print("YO is working!")
end
Enter fullscreen mode Exit fullscreen mode

Challenges I Faced

The most difficult part was building the parser.

Reading text is easy.

Understanding program structure is much harder.

I had to design rules that could correctly identify:

  • Expressions
  • Statements
  • Nested blocks
  • Control flow structures

Debugging parser errors often took longer than writing the actual code.

Publishing YO

After the interpreter was working, I wanted other developers to try it.

So I:

  • Created a GitHub repository
  • Packaged the project
  • Published it on PyPI

Now it can be installed using:

pip install yo-lang
Enter fullscreen mode Exit fullscreen mode

What I Learned

This project taught me:

  • Compiler Design Fundamentals
  • Language Parsing Techniques
  • Abstract Syntax Trees
  • Runtime Execution Models
  • Python Package Distribution
  • Open Source Project Management

More importantly, it helped me understand what happens behind the scenes when we write code in any programming language.

Future Roadmap

Upcoming features include:

  • User-defined Functions
  • Classes and Objects
  • Modules and Imports
  • Package Manager
  • VS Code Extension
  • Better Error Diagnostics

Links

GitHub Repository:

PyPI Package:

Final Thoughts

Building a programming language was one of the most challenging and rewarding projects I have worked on as a student.

It pushed me beyond application development and forced me to think about how software tools themselves are built.

If you're a student interested in compilers, interpreters, or language design, I highly recommend trying to build a small programming language yourself. You'll learn far more than you expect.

Top comments (0)