DEV Community

Cover image for Introducing Bhasha - A transcoder
Aditya Mandke
Aditya Mandke

Posted on

Introducing Bhasha - A transcoder

We all speak different languages, the computers do so too. But from a programming perspective, it sometimes becomes a bit tedious to keep shifting from one language to the other as the use case keeps changing. For example, for data science purposes, we all commonly use Python, for desktop applications, we require Java, C++, and so on. For some, the task of learning so many different languages can lead to a turndown for exploring the different avenues of applying CS.

But what if we can write code in one language and it gets completely transformed to code in an another language, which produces the same output as before?

That is what I am trying to do with 'bhasha'. ('bhasha' means language in Hindi)

At the moment it supports Python to C++ transcoding, with support for python print statements, and comments.

Instead of using AI, I am taking more of a hard-coded and algorithmic approach.

Bhasha implements a text extraction engine which extracts the required text (let it be the text enclosed in 'print()' or the comments), using regex, and then a generate_code() function which creates a new C++ file with the same functionality.

And the best part, while running the code, it is so simple, it requires only 3 lines!

Check out the code:

GitHub logo ekdnam / bhasha

Creating a unified interface for programming

bhasha

Creating a unified interface for programming.

We all have to keep learning so many different programming languages, as all of them have different utilities. But, this is not efficient. Thus, bhasha is being created with one point in mind, write code in one language, bhasha will transform it to an another language.

cplusplus

Transforming your python code to cpp code. Currently only print statements supported.




(Check the different branches)

If we can perhaps create a community to take the project forward, it'd be amazing!

Your thoughts and comments are deeply appreciated!

Top comments (0)