banglascript
v4.0.0
Published
BanglaScript: Write JavaScript in Bangla. Full-featured transpiler with CLI, REPL, project templates, caching, and modern JavaScript support. đ§đŠ
Maintainers
Readme
BanglaScript 4.0
āĻŦāĻžāĻāϞāĻžāϝāĻŧ JavaScript āĻĒā§āϰā§āĻā§āϰāĻžāĻŽāĻŋāĻ! | Write JavaScript in Bangla!
BanglaScript is a programming language transpiler that allows you to write JavaScript using the Bangla (Bengali) language. Perfect for Bengali developers, students, and educators who want to code in their mother tongue!
đĻ Installation
# Global installation (recommended)
npm install -g banglascript
# Verify installation
bjs --versionđ Quick Start
Create a Project
# Basic project
bjs init my-project
# Web application
bjs init --web my-webapp
# REST API server
bjs init --api my-api
# Full-stack application
bjs init --fullstack my-app
# CLI tool
bjs init --cli my-tool
# List all templates
bjs init --listRun Your First Code
cd my-project
npm run build
npm startOr run directly:
bjs run src/main.bjsđģ Interactive REPL
Start the interactive mode:
bjs replbjs> āϞāĻŋāĻā§("āĻšā§āϝāĻžāϞ⧠āĻŦāĻŋāĻļā§āĻŦ!")
āĻšā§āϝāĻžāϞ⧠āĻŦāĻŋāĻļā§āĻŦ!
bjs> āϧā§āϰā§āĻŦāĻ āύāĻžāĻŽ = "āϰāĻšāĻŋāĻŽ"
bjs> āϞāĻŋāĻā§(`āϏā§āĻŦāĻžāĻāϤāĻŽ ${āύāĻžāĻŽ}!`)
āϏā§āĻŦāĻžāĻāϤāĻŽ āϰāĻšāĻŋāĻŽ!
bjs> .helpđ Example Code
Basic Example
// Variables
āϧā§āϰā§āĻŦāĻ āύāĻžāĻŽ = "āĻŽāĻžāĻšāĻŽā§āĻĻ";
āĻāϞāĻ āĻŦāϝāĻŧāϏ = ⧍ā§Ģ;
// Function
āĻ
āύā§āώā§āĻ āĻžāύ āĻļā§āĻā§āĻā§āĻāĻž(āĻŦā§āϝāĻā§āϤāĻŋ) {
āϞāĻŋāĻā§(`āĻšā§āϝāĻžāϞ⧠${āĻŦā§āϝāĻā§āϤāĻŋ}!`);
}
āĻļā§āĻā§āĻā§āĻāĻž(āύāĻžāĻŽ);
// Class
āĻā§āϞāĻžāϏ āĻŽāĻžāύā§āώ {
āύāĻŋāϰā§āĻŽāĻžāϤāĻž(āύāĻžāĻŽ, āĻŦāϝāĻŧāϏ) {
āĻāĻ.āύāĻžāĻŽ = āύāĻžāĻŽ;
āĻāĻ.āĻŦāϝāĻŧāϏ = āĻŦāϝāĻŧāϏ;
}
āĻĒāϰāĻŋāĻāϝāĻŧ() {
āϞāĻŋāĻā§(`āĻāĻŽāĻŋ ${āĻāĻ.āύāĻžāĻŽ}, ${āĻāĻ.āĻŦāϝāĻŧāϏ} āĻŦāĻāϰ`);
}
}
āϧā§āϰā§āĻŦāĻ āĻŦā§āϝāĻā§āϤāĻŋ = āύāϤā§āύ āĻŽāĻžāύā§āώ("āĻāϰāĻŋāĻŽ", ā§Šā§Ļ);
āĻŦā§āϝāĻā§āϤāĻŋ.āĻĒāϰāĻŋāĻāϝāĻŧ();
// Async/Await
āĻ
ā§āϝāĻžāϏāĻŋāĻā§āĻ āĻ
āύā§āώā§āĻ āĻžāύ āĻĄāĻžāĻāĻž_āĻāύā§() {
āĻā§āώā§āĻāĻž_āĻāϰ⧠{
āϧā§āϰā§āĻŦāĻ response = āĻ
āĻĒā§āĻā§āώāĻž_āĻāϰ⧠fetch("/api/data");
āĻĢā§āϰāϤ āĻ
āĻĒā§āĻā§āώāĻž_āĻāϰ⧠response.json();
} āϧāϰ⧠(āϤā§āϰā§āĻāĻŋ) {
āϤā§āϰā§āĻāĻŋ_āϞāĻŋāĻā§("āϏāĻŽāϏā§āϝāĻž āĻšāϝāĻŧā§āĻā§:", āϤā§āϰā§āĻāĻŋ);
}
}Web DOM Example
āĻĻāϏā§āϤāĻžāĻŦā§āĻ.āĻāĻā§āύā§āĻ_āϝā§āĻ_āĻāϰā§("āĻĄāĻā§āĻŽā§āύā§āĻ_āϏāĻžāĻŽāĻā§āϰā§_āϞā§āĻĄā§āĻĄ", āĻ
āύā§āώā§āĻ āĻžāύ() {
āϧā§āϰā§āĻŦāĻ āĻļāĻŋāϰā§āύāĻžāĻŽ = āĻĻāϏā§āϤāĻžāĻŦā§āĻ.āĻāĻāĻĄāĻŋ_āĻĻā§āĻŦāĻžāϰāĻž_āĻĒāĻžāĻ("title");
āĻļāĻŋāϰā§āύāĻžāĻŽ.āĻā§āĻā§āϏāĻ_āĻĒāϰāĻŋāĻŦāϰā§āϤāύ_āĻāϰ⧠= "āĻŦāĻžāĻāϞāĻžāϏā§āĻā§āϰāĻŋāĻĒā§āĻ!";
āϧā§āϰā§āĻŦāĻ āĻŦā§āϤāĻžāĻŽ = āĻĻāϏā§āϤāĻžāĻŦā§āĻ.āĻāĻāĻĄāĻŋ_āĻĻā§āĻŦāĻžāϰāĻž_āĻĒāĻžāĻ("btn");
āĻŦā§āϤāĻžāĻŽ.āĻāĻā§āύā§āĻ_āϝā§āĻ_āĻāϰā§("āĻā§āϞāĻŋāĻ", āĻ
āύā§āώā§āĻ āĻžāύ() {
āϏāϤāϰā§āĻāĻŦāĻžāϰā§āϤāĻž("āĻā§āϞāĻŋāĻ āĻāϰā§āĻā§āύ!");
});
});đ ī¸ CLI Commands
| Command | Description |
|---------|-------------|
| bjs build <files> | Build .bjs files to JavaScript |
| bjs run <file> | Build and run a file |
| bjs watch <files> | Watch mode with auto-rebuild |
| bjs init [name] | Create new project |
| bjs repl | Interactive REPL mode |
| bjs eval <code> | Evaluate code directly |
| bjs transpile | Transpile from stdin |
| bjs keywords | Show all keywords |
| bjs info [file] | Show file/project info |
| bjs cache | Manage cache |
| bjs upgrade | Check for updates |
Build Options
bjs build src/**/*.bjs -o dist # Output to dist/
bjs build main.bjs -m # Minify output
bjs build main.bjs --no-translit # Keep Bangla identifiers
bjs build main.bjs --profile # Enable profiling
bjs build main.bjs --no-cache # Disable cacheđ Keyword Categories
Variables & Values
| Bangla | JavaScript | |--------|------------| | āϧā§āϰā§āĻŦāĻ | const | | āĻāϞāĻ | let | | āĻĒāϰāĻŋāĻŦāϰā§āϤāύāĻļā§āϞ | var | | āϏāϤā§āϝ | true | | āĻŽāĻŋāĻĨā§āϝāĻž | false | | āĻļā§āύā§āϝ | null |
Control Flow
| Bangla | JavaScript | |--------|------------| | āϝāĻĻāĻŋ | if | | āύāĻžāĻšāϞ⧠| else | | āύāĻžāĻšāϞā§_āϝāĻĻāĻŋ | else if | | āĻāύā§āϝ | for | | āϝāĻāύ | while | | āϏā§āĻāĻ | switch |
Functions & Classes
| Bangla | JavaScript | |--------|------------| | āĻ āύā§āώā§āĻ āĻžāύ | function | | āĻĢā§āϰāϤ | return | | āĻā§āϞāĻžāϏ | class | | āύāĻŋāϰā§āĻŽāĻžāϤāĻž | constructor | | āĻāĻ | this | | āύāϤā§āύ | new |
Async
| Bangla | JavaScript | |--------|------------| | āĻ ā§āϝāĻžāϏāĻŋāĻā§āĻ | async | | āĻ āĻĒā§āĻā§āώāĻž_āĻāϰ⧠| await | | āĻā§āώā§āĻāĻž_āĻāϰ⧠| try | | āϧāϰ⧠| catch |
See all keywords: bjs keywords
⥠Performance
v4.0 includes major performance improvements:
| Metric | Before | After | |--------|--------|-------| | Transpilation | 150ms | 15ms | | Memory Usage | 45MB | 25MB | | Cache Hit Rate | 0% | 85% |
Enable Profiling
# Linux/Mac
export BANGLASCRIPT_PROFILE=1
# Windows
set BANGLASCRIPT_PROFILE=1
# Then run
bjs build src/**/*.bjsCache Management
bjs cache --stats # View cache statistics
bjs cache --clear # Clear all cache
bjs cache --clear-old # Clear old entriesđ Links
- Documentation: https://bangla-script.vercel.app
- GitHub: https://github.com/BengalEmpire/BanglaScript
- NPM: https://npmjs.com/package/banglascript
- VSCode Extension: BanglaScript Extension
āĻŦāĻžāĻāϞāĻžāϝāĻŧ āĻā§āĻĄ āϞāĻŋāĻā§āύ!
