BROCODE is a toy programming language designed to bring Hindi-style syntax to programming, making it more accessible and fun for Hindi-speaking developers! π Perfect for those who want to enjoy programming in a language they speak daily.
- Introduction
- Official Website
- Installation
- Usage
- BROCODE Syntax
- DOM Integration
- Features
- See BROCODE in Action
For detailed documentation, check out the official BROCODE documentation:
Visit the official website for BROCODE:
npm install -g brocode-cli@latest
// hello.bc
// A basic program to find the factorial of a number
bro function FACTORIAL(n) {
bro maanle fact hai 1;
bro maanle i hai 1;
bro jbb tk (i <= n) hai {
bro maanle fact hai fact * i;
i++;
}
bro dikha de("Factorial of " + n + " is: " + fact);
}
FACTORIAL(5);
brocode your-file.bc
OR
npx brocode your-file.bc
- Basic usage:
brocode filename.bc
- Debug mode:
brocode filename.bc --debug
- Hindi-style syntax for better understanding
- Clear error messages
- Debug mode for development
- Easy to use CLI interface
// Declaring variable 'num' and assigning value 5
bro maanle num hai 5;
bro dikha de("Hello World!");
bro function <functionName>(pram_a, param_b) {
bro dikha de(pram_a + param_b);
}
<functionName>(5, 3);
//Declaring num with 2
bro maanle num hai 2;
// if statement
bro agar (num < 3){
bro dikha de("Number is less than 3");
}
//else statement
bro leave it{
bro dikha de("Number is greater than 3");
}
// Declaring initial value from where loop starts
bro maanle num hai 2;
// defining while loop with condition num < 3
bro jbb tk (num < 3) hai {
bro dikha de(num);
// break statement
bro nikal;
// incrementing num
num++;
}
To set up DOM functionality in your project, follow these steps:
- Add this in the
<head>
tag:
<script src="https://brocode-cli.vercel.app/api/ajj-kuch-tufani-krte-hai"></script>
- Create a
<bro-script>
tag at the end of your body tag:
<bro-script src="index.bc"></bro-script>
Make sure to provide the correct path to your .bc
file.
That's it! You're good to go. π
bro ye id ("<id>") wala lake <variable> me rakhde;
bro isko ("<selector>") uthake <variable> me rakhde;
bro iske ("<selector>") jese sab uthake <variable> me rakhde;
bro <element> ka html bdl ke ("<new content>") krde;
bro <element> ka text bdl ke ("<new content>") krde;
bro <element> ka attribute ("<name>", "<value>") set krde;
bro <element> ka attribute ("<name>") le aa;
bro <element> ka attribute ("<name>") hta de;
bro <element> ka <property> "<value>" krde;
bro <element> ki classes me "<className>" add krde;
bro <element> ki classes me "<className>" remove krde;
bro <element> ki classes me "<className>" toggle krde;
bro <element> pe sun ("<event>", <function()>);
bro <element> pe sunna bnd kr ("<event>", <function()>);
bro document me "<tagName>" ka nya element <variable> me bna de;
bro <element> me <childElement> append krde;
bro <element> hta de;
bro <element> ka parent <variable> me rakhde;
bro <element> ka children <variable> me rakhde;
bro <inputElement> ki value <variable> me rakhde;
bro <element> me scroll krde;
bro window ko (x, y) tkk scroll krde;
Yes now you can make basic web applications with BROCODE π