DEV Community

Cover image for Journey of creating a programming language: Bat Lang
Samiun Black
Samiun Black

Posted on

Journey of creating a programming language: Bat Lang

Quick Access

If you're eager to dive into the Bat Lang playground without delay, just click here: Bat Lang Playground

The Birth of Bat Lang

In the vast and creative universe of programming languages, where each line of code tells a unique story, I embarked on a journey to create something different—something that not only brings functionality but also a smile. Being a longtime fan of Batman, I couldn't resist the idea of gifting the Dark Knight his very own programming language. And thus, Bat Lang was born.

Design and Inspiration: Crafting the Bat Code

Bat Lang, being a toy language designed for fun, took shape as an interpreted language. The design philosophy draws inspiration from iconic elements of the Batman universe—Batarangs, the Bat Signal, and the utility belt. It's not just about writing code; it's about weaving a narrative with each line.

Implementation Adventures

Choosing Python as the canvas, I initially experimented with third-party lexer and parser tools. However, the journey became more frustrating than anticipated. So, I pivoted and decided to build everything from scratch. The lexer was a breeze, but crafting the Abstract Syntax Tree (AST) and the parser brought its set of challenges. The interpreter and environment creation, while relatively straightforward, presented some intricacies. Dealing with bugs in the parser became an ongoing quest. The main challenge? Understanding and implementing the execution order of code blocks. Adding features like functions and arrays added complexity, but perseverance won the day.

Features that Make Bat Lang Soar

Bat Lang allows you to perform the usual programming tasks—printing, variable declarations, conditions, loops, arrays, and functions. However, what truly sets it apart is not just what you can do, but how you do it. Every syntax element is Batman-themed. For instance, to print something, you use a function called BatSignal(), and to declare a variable, you employ the keyword batarang.

Future Plans: Unveiling the Road Ahead

In the spirit of continuous improvement, the first order of business is cleaning up the codebase. Looking forward, plans include incorporating more features into Bat Lang, such as Object-Oriented Programming (OOP) and expanding the repertoire of built-in data structures and functions.

Explore and Share Your Thoughts!

Ready to experience Bat Lang? Dive into the live playground: Bat Lang Playground

If you have any question or feedback about Bat Lang I would be more than happy to hear them out. Let's make coding an extraordinary journey together!

Top comments (0)