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.

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.
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.
npm install banglascript-transpiler
yarn add banglascript-transpiler
pnpm add banglascript-transpiler

Transpile BanglaScript code to JavaScript using the programmatic API and log the result.

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