DEV Community

prince pandit
prince pandit

Posted on

How I Invented "Lodu Code" - The Most Aggressive Desi Programming Language

Have you ever felt that modern programming languages are just too... polite? You miss a semicolon or misindent a block, and Python gently whispers, SyntaxError: invalid syntax.

I wanted a language that matched the true, chaotic, and aggressive energy of an Indian engineering hostel. A language that doesn't just throw errors, but actively roasts you for forgetting your manners.

So, I built one. My name is Prince Kumar Pandit, and I am the inventor of Lodu Code.

In this article, I’ll walk you through how what started as a joke turned into a full-fledged compiler engineering project complete with its own VS Code Extension, a PyPI package, and a web-based playground.

🦊 What is Lodu Code?

Lodu Code is an esoteric programming language (esolang) built on top of Python. But unlike typical languages, Lodu Code operates on a principle of "Strict Sanskar" (Manners).

If you don't start your program by greeting the compiler, it refuses to run.

Here is what a standard "Hello World" looks like:

Namaste

ab sun {
chl ab print kar("Hello World! Jalwa hai bhai ka!")
}

Khatm, tata, goodbye

If you forget to write Namaste at the top, the interpreter will literally output:

Error: Abe lawde! Sanskar bhool gaya? Pehle 'Namaste' likh!

It has variables (bkl), terminal inputs (bsdk input daal), loops (jab tak), conditionals (agar/varna), and even custom functions (abe saale).

🛠️ The Engineering: Building the Interpreter

Many people assume esoteric languages are just simple "find-and-replace" wrappers around Python or JavaScript. But as the creator of Lodu Code, I wanted to build a proper line-by-line interpreter from scratch to understand how lexical parsing and execution flow actually work.

Here is how the Lodu Code Engine works under the hood:

  1. Pre-processing and Control Flow (Jumps)

Instead of relying on Python's native while or if/else loops, I implemented a custom stack and jumps dictionary.
Before execution, the engine scans the .lodu file, finds matching { and } brackets, and maps their line numbers. When the engine encounters a jab tak (while) loop, it evaluates the condition. If false, it instantly jumps to the mapped closing bracket line.

  1. State Management (Memory)

Lodu Code manages its own state. I created a dedicated variables = {} dictionary. When the engine reads bkl a = 10, it doesn't declare a Python variable; it stores "a": 10 in its custom memory dictionary, which is referenced later for math operations.

  1. The Call Stack

To support custom functions (abe saale myFunction() { ... }) and return statements (wapas aa), I implemented a call_stack. When a function is called, the engine pushes the current line number to the stack, jumps to the function's starting line, executes it, and pops the stack to return to the exact line where it left off.

🌍 Building the Developer Ecosystem

Creating the language was only half the battle. I wanted Lodu Code to feel like a real developer tool.

The VS Code Extension

Writing code without syntax highlighting is a nightmare. So, I learned how to use TextMate grammars and JSON configurations to build an official VS Code extension. It highlights Lodu Code keywords, handles bracket matching, and even slaps a custom Fox logo 🦊 on all .lodu files. You can find it on the VS Code Marketplace by searching "Lodu Code Support".

Global Distribution (PyPI)

I packaged the Python execution engine and published it to the Python Package Index (PyPI). Now, anyone in the world can install the language globally on their system:

pip install lodu-code

The Web Playground

To reduce friction for non-developers, I built a static website with an embedded JavaScript-based mock engine. It utilizes advanced Regex to parse Lodu Code directly in the browser, complete with a live terminal output and browser prompts for input.

🚀 Final Thoughts

Inventing Lodu Code was an incredible journey into the depths of software engineering. Building an interpreter from scratch teaches you so much about parsing, regex, abstract syntax trees (conceptually), and state management.

If you are a student or a developer looking for a fun weekend project, I highly recommend trying to build your own toy language. It completely demystifies how code runs on a machine.

Check out Lodu Code here:

PyPI: lodu-code

Website / Playground: [https://lodu-code-website.vercel.app/]

GitHub: [https://github.com/aroyalprince/Lodu-Code]

Drop a comment below if you have ever tried making an esolang, or let me know what aggressive features I should add to Lodu Code next!

Written with ❤️ and 😡 by Prince Kumar Pandit, Inventor of Lodu Code.

Top comments (0)