MCPcopy Create free account
hub / github.com/DulLabs/bhai-lang

github.com/DulLabs/bhai-lang @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
297 symbols 619 edges 115 files 2 documented · 1% 10 cross-repo links updated 2y ago★ 4,09255 open issues

Browse by type

Functions 174 Types & classes 123
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Bhai Lang

Total alerts Language grade: JavaScript Build Build Build

This is official repository for bhai-lang.

Bhai lang is a toy programming language written in Typescript.

Installation

npm i -g bhailang

Usage

Create a new file (test.bhai)

Edit the file with a text editor. You can also try out your code on Bhai Lang PlayGround

hi bhai
  bol bhai "Hello bhai";
bye bhai

Run

bhailang test.bhai

Output

hello bhai

Documentation

General

hi bhai is the entrypoint for the program and all program must end with bye bhai. Anything outside of it will be ignored.


This will be ignored

hi bhai
// Write code here
bye bhai

This too

Variables

Variables can be declared using bhai ye hai.


hi bhai
  bhai ye hai a = 10;
  bhai ye hai b = "two";
  bhai ye hai c = 15;
  a = a + 1;
  b = 21;
  c *= 2;
bye bhai

Types

Numbers and strings are like other languages. Null values can be denoted using nalla. sahi and galat are the boolean values.


hi bhai
  bhai ye hai a = 10;
  bhai ye hai b = 10 + (15*20);
  bhai ye hai c = "two";
  bhai ye hai d = 'ok';
  bhai ye hai e = nalla;
  bhai ye hai f = sahi;
  bhai ye hai g = galat;
bye bhai

Built-ins

Use bol bhai to print anything to console.


hi bhai
  bol bhai "Hello World";
  bhai ye hai a = 10;
  {
    bhai ye hai b = 20;
    bol bhai a + b;
  }
  bol bhai 5, 'ok', nalla , sahi , galat;
bye bhai

Conditionals

Bhailang supports if-else-if ladder construct , agar bhai block will execute if condition is sahi, otherwise one of the subsequently added nahi to bhai blocks will execute if their respective condition is sahi, and the warna bhai block will eventually execute if all of the above conditions are galat


hi bhai
  bhai ye hai a = 10;
  agar bhai (a < 20) {
    bol bhai "a is less than 20";
  } nahi to bhai ( a < 25 ) {
    bol bhai "a is less than 25";
  } warna bhai {
    bol bhai "a is greater than or equal to 25";
  }
bye bhai

Loops

Statements inside jab tak bhai blocks are executed as long as a specified condition evaluates to sahi. If the condition becomes galat, statement within the loop stops executing and control passes to the statement following the loop. Use bas kar bhai to break the loop and agla dekh bhai to continue within loop.


hi bhai
  bhai ye hai a = 0;
  jab tak bhai (a < 10) {
   a += 1;
   agar bhai (a == 5) {
    bol bhai "andar se bol bhai ", a;
    agla dekh bhai;
   }
   agar bhai (a == 6) {
    bas kar bhai;
   }
   bol bhai a;
  }
  bol bhai "done";
bye bhai

Development

You can explore abstract syntax tree(AST) of bhailang here.

Extension points exported contracts — how you extend this code

browse all types & interfaces →

Core symbols most depended-on inside this repo

browse all functions →

Shape

Method 137
Class 119
Function 37
Interface 4

Languages

TypeScript100%

Modules by API surface

packages/parser/src/module/bhaiLangModule.ts31 symbols
packages/interpreter/src/components/scope.ts12 symbols
packages/parser/src/components/tokenizer/index.ts8 symbols
packages/parser/src/components/parser/tokenExecutor.ts7 symbols
packages/parser/src/components/parser/statement/variableStatement.ts7 symbols
packages/parser/src/components/tokenizer/types.ts6 symbols
packages/parser/src/components/parser/statement/expression/index.ts6 symbols
packages/parser/src/components/parser/statement/expression/assignmentExpression.ts6 symbols
packages/interpreter/src/module/interpreterModule.ts6 symbols
packages/interpreter/src/components/visitor/binaryExpression.ts6 symbols
packages/parser/src/components/parser/statementList.ts5 symbols
packages/parser/src/components/parser/statement/printStatement.ts5 symbols

Dependencies from manifests, versioned

@parcel/packager-ts2.2.0 · 1×
@parcel/transformer-typescript-types2.2.0 · 1×
@sentry/nextjs6.18.2 · 1×
@types/gtag.js0.0.8 · 1×
@types/jest27.4.0 · 1×
@types/prismjs1.16.8 · 1×
@types/react17.0.37 · 1×
autoprefixer10.4.2 · 1×
bhai-lang-interpreter* · 1×
bhai-lang-parser* · 1×
chalk5.0.0 · 1×

For agents

$ claude mcp add bhai-lang \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page