banglascript-transpiler
raw JSON → 1.0.0 verified Fri May 01 auth: no javascript
A toy transpiler that converts BanglaScript (a beginner-friendly programming language using Bangladeshi GEZ-Z slang keywords) into JavaScript. Version 1.0.0 is the initial release. It translates BanglaScript keywords like 'bro' (let), 'funde' (function), 'jodi' (if), 'bolchi' (console.log) into standard JavaScript. Primarily educational or novelty use; not intended for production. No regular release cadence. Differentiator: it makes programming accessible to Bengali speakers by using localized keywords.
Common errors
error Error: Cannot find module 'banglascript-transpiler' ↓
cause Package not installed or wrong import path.
fix
Run 'npm install banglascript-transpiler' and ensure correct import: import transpile from 'banglascript-transpiler'
error bash: banglascript: command not found ↓
cause CLI binary not in PATH; package not installed globally.
fix
Install globally: 'npm install -g banglascript-transpiler'. Or use npx: 'npx banglascript input.bns output.js'
error TypeError: transpile is not a function ↓
cause Default import may not yield a function; module might export differently.
fix
Check the actual export: e.g., import * as transpiler from 'banglascript-transpiler'. Refer to package source.
Warnings
breaking The CLI command is 'banglascript', not 'banglascript-transpiler'. Running 'banglascript-transpiler input.bns' will fail. ↓
fix Use 'npx banglascript' or install globally with 'npm install -g banglascript-transpiler' and run 'banglascript'.
gotcha The programmatic API is not documented; the module may not export a function as expected. Users may have to inspect the package internals. ↓
fix Import the transpiler function: import transpile from 'banglascript-transpiler' or use CLI instead.
gotcha BanglaScript is a toy language; it is not suitable for production. Using it in serious projects may lead to unexpected behavior or lack of support. ↓
fix Use for learning or fun only. Do not rely on it for critical applications.
deprecated The package uses CommonJS require in examples but may be ESM-only. Using require may fail. ↓
fix Check package.json for 'type': 'module'. Use ESM import syntax.
Install
npm install banglascript-transpiler yarn add banglascript-transpiler pnpm add banglascript-transpiler Imports
- Default import of the transpiler function wrong
const transpile = require('banglascript-transpiler');correctimport transpile from 'banglascript-transpiler'; - CLI usage via npx wrong
banglascript input.bns output.js (if not installed globally)correctnpx banglascript input.bns output.js - Programmatic transpile API
import transpile from 'banglascript-transpiler'; const jsCode = transpile(banglaScriptCode);
Quickstart
const fs = require('fs');
const transpile = require('banglascript-transpiler');
const inputCode = `
bro taka = 100;
funde discount(taka) {
jodi (taka > 500) {
bolchi("Boro taka:", taka - 50);
} naile {
bolchi("Chhoto taka:", taka - 10);
}
oi mama taka;
}
discount(taka);
`;
const outputCode = transpile(inputCode);
console.log(outputCode);
// Expected JS output includes variable declarations and function with if-else and console.log