Open In App

Bhailang – A Toy Programming Language

Improve
Improve
Like Article
Like
Save
Share
Report

Coding involves a wide array of programming languages. A beginner might find the syntax intimidating. What about if there was a Hindi linguistic version of coding? After all these programming languages such as C, C++, and Python, here we have Bhailang, created by our own Indian engineers spawned out of inside jokes. Bhailang is a toy language written in Typescript. The term ‘toy language’ refers to any computer programming language that does not meet the standards for general purpose applications. 

Key Terminologies

  • Entry & Exit point: A program must begin with a hi bhai and end with a bye bhai
  • Variables: Variables are declared with bhai ye hai.
  • Datatype: Numbers and strings are just like any other language. Null values are indicated with nalla. Sahi and Galat represent boolean values.
  • Output: Any console output can be printed with bol Bhai.
  • Conditionals: If the condition is Sahi (True), then the agar bhai (if) block will be executed, and if the condition is galat (false), then the warna bhai (else)  block will be executed.
  • Loops: Jab tak bhai blocks execute statements as long as a specified condition evaluates to sahi (true). Upon reaching galat, the statement within the loop stops executing, and control passes to the statement following the loop. 
  • Control Statements: Break the loop with bas kar bhai (break) and continue within it with agla dekh (continue) bhai.
  • Errors: It throws a syntax error with Kya kar rha hai tu statement. 

Steps to try Bhailang:

Step 1: Environment Setup 

  • Install Visual Studio code on your local machine. 

          Download Link: https://code.visualstudio.com/download

  • Make sure you have Node.js installed. Download it using the link below if you haven’t already. 

          Download Link: https://nodejs.org/en/

  • Install Bhailang globally by using the following command 

npm i -g bhailang

Installing-Bhailang

Installing bhailang

  • In Visual Studio code go to Extensions or press Ctrl + shift + x to open extensions. Search Bhailang – syntax highlight, autocomplete extension and install it. 

Installing Bhailang extension in Vs code 

Step 2: Create a file named gfg.bhai in a new project directory.

Bhailang files have the extension .bhai

We will start our program with hi bhai and end it with bye bhai. In this example, we will declare a few variables and explore the use of conditions and loops in Bhailang. 

Add the following code in gfg.bhai file.

// Entry point 

hi bhai

// bol bhai- prints the statements in console 

 bol bhai “Welcome to GeeksforGeeks!”;

 bol bhai “Let’s code in our Hindi Lingo using Bhailang”;

// Declaring the Variables 

  bhai ye hai a = 5;

  bhai ye hai b = 3;

// Sahi represents a boolean value True

  bhai ye hai c = sahi; 

  bhai ye hai d = galat;

// loop 

  jab tak bhai (b < 8) {

        bol bhai b;

       // if else construct

       agar bhai (b == a){

      bol bhai “b is equal to a”;

     bol bhai c; 

}

    warna bhai 

    bol bhai d ; 

    b += 1;

}

 // exit point 

bye bhai 

Step to run the program 

Run the program by using the following command.

bhailang <your file name > 

bhailang gfg.bhai 

Output

Output-Window

Bhailang Program Output 


Last Updated : 28 Mar, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads