Bnlang · Programming Language

About Bnlang

Bnlang is a multilingual programming language and runtime created primarily for Bangladesh. It lets developers think and learn in their mother tongue—বাংলা—collaborate, and ship in English without changing semantics, tooling, or production readiness.

Why Bnlang (for Bangladesh)

People think and work across languages—learn in Bangla, search and ship in English. Traditional languages force one surface form; Bnlang adapts to you. Teach, learn, prototype, and run in production using the script you’re most comfortable with—without forking the ecosystem or sacrificing engineering rigor.

  • Onboarding speed: the same example exists in three surface forms with identical behavior—English, বাংলা.
  • Review clarity: diagnostics and formatting keep mixed-language code legible and consistent.
  • No translation tax: learn core ideas in Bangla, ship to production in English if required.
What this page covers (and why)

Each section explains the rationale behind language design, runtime, interop, and community. It’s written for teachers, adopters, and contributors who need to assess Bnlang for real projects.

Project status
bnl-vscode, bnl-web (website), and bpm are open source and free. The main Bnlang runtime source is private today (planned to open source later).
Cost
Bnlang distributions and tooling are completely free to use—no license fees, no hidden charges. Individuals, schools, and companies can adopt it without cost barriers, making it accessible for learning, collaboration, and production deployment.

How it works (why these choices)

Bnlang is a native, tree-walking interpreter written in modern C++. It embeds libuv for async I/O and pairs with proven libraries — OpenSSL, llhttp, zlib, SQLite, libpq, mongo-c-driver — so schools and companies get one self-contained binary that just runs on Windows, Linux, and macOS.

Frontend: Lexer, Parser, Checker
  • Bilingual tokens normalized (Bangla/English) into a single AST.
  • Static checks for scope and arity; bilingual diagnostics.
  • UTF-8 throughout — Bangla identifiers and keywords are first-class.
Backend: Native C++ Interpreter
  • Tree-walking evaluator implemented directly in C++ — no virtual machine, no transpilation.
  • Values, closures, classes, and modules are native C++ types with `shared_ptr` lifetimes.
  • libuv event loop drives async callbacks, timers, networking, and file I/O.

Execution model: Bnlang is a native tree-walking interpreter written in C++. No transpilation, no virtual machine — the runtime evaluates the AST directly and dispatches async I/O through libuv.

Native Stdlib & FFI: C++
  • Built-in modules (HTTP server/client, WebSocket, templates, three DB drivers, crypto, JSON, …) live in C++ for speed.
  • Distributable as `bnl.exe` + `bnl_core.dll`/`.so`/`.dylib`, or a single static binary.
  • FFI plugin loader — drop a `.dll`/`.so`/`.dylib` next to a `bnl.json` to extend the runtime without recompiling bnl.
Packages & Stdlib (why)
BPM provides integrity checks and semantic versions. The standard library covers I/O, HTTP/WebSocket, templates, three databases, crypto, and text utilities — bilingual where it matters, identical behavior on every OS.
Tooling (why)
REPL, test runner, formatter, and scaffolding ship with the language. Upgrades stay predictable in classrooms and CI because tools evolve together.
Interop (why not a walled garden)
Embed `bnl_core` directly into a C++ host application, or load native plugins at runtime via the FFI loader. No transpilation step — the interpreter is the runtime.

Runtime Stack (under the hood)

Pragmatic, portable, and proven components for Bangladesh today.

C++20
The whole Bnlang runtime is modern C++ — lexer, parser, tree-walking interpreter, value model, and every built-in native module. No VM, no transpilation step.
libuv
Cross-platform async I/O for networking, filesystem, timers, event loop, and child processes — a battle-tested foundation for high-throughput, non-blocking workloads.
OpenSSL
TLS for HTTPS and WebSocket-over-TLS, plus the building blocks of the crypto module (hashing, HMAC, base64/hex codecs, secure random).
llhttp
Fast, security-audited HTTP/1.1 parser. Powers the built-in HTTP request + response parsers used by the web server and client.
SQLite · libpq · mongo-c-driver
Database drivers compiled in. SQLite for embedded use; libpq for PostgreSQL; mongo-c-driver for MongoDB — all behind a uniform `import "pg"` / `import "sqlite"` / etc. API.
zlib
gzip / deflate / raw inflate. Used for HTTP content-encoding and general data processing.

Language design (why it feels right)

The parser accepts three surface forms; the compiler treats them equally. You teach and work in the language you think in—without a 'special mode' of code.

Dual Keywords & APIs
Control flow and declarations exist in Bangla/English; tooling normalizes for analysis and output.
Safety & Clarity
Explicit imports, predictable scoping, strict formatter, and readable errors keep reviews focused on logic.
Accessibility-first
Unicode-safe punctuation, examples aligned with common Bangla keyboard habits, and bilingual diagnostics.

Accessibility for Bangladesh (why it’s a priority)

Language Reality
Learn in Bangla, search in English. Bnlang meets all three without 'mode switching'.
Fonts & Unicode
Compiler and formatter handle Bangla punctuation/numerals; docs recommend widely available fonts.
Low Bandwidth & Power
Small downloads, deterministic installs, and offline docs reduce friction in real classrooms.

Interop & adoption (why not reinvent the world)

Import / Export
Leverage existing C/C++ libraries; export clean interfaces. Deploy on any platform supported by the runtime.
Incremental Migration
Start with scripts or one service; keep the rest in existing languages. Move hot paths to C++ only when needed.
Deterministic Builds
Lockfiles and checksums make CI and lab machines behave the same—even with flaky connectivity.

Governance, license & security (why you can trust it)

Open Governance
Community RFCs shape changes. Breaking changes ship with migration guides and tool support.
Licensing
bnl-vscode, bnl-web, and bpm are open source; the main runtime source is private for now (planned open source). All are free to use.
Security & Telemetry
Responsible disclosure, signed artifacts, and optional, privacy-respecting telemetry (opt-out anytime).

Roadmap (near-term priorities)

v1.x Stability
Lock core syntax, finalize stdlib modules, and announce LTS windows for educators and companies.
Tooling Depth
Language server polish, better editor integration, and improved debug/trace ergonomics.
Native Performance
Expand C++ modules, profile hot paths, and provide prebuilt binaries for all supported OS/arch pairs.

Community & Governance

Join discussions, propose RFCs, and help shape the roadmap. From documentation to core packages—every contribution matters.