Chapter 1

Introduction, Vision & Zero-Dependency Pure Go Philosophy

BramandScript (from the Sanskrit Brahmand, meaning "Universe" or "Cosmos") is an independent, general-purpose programming language created to provide complete execution sovereignty. It is engineered from scratch in Go's standard library (stdlib) without relying on a single external package or third-party runtime.

Architectural Principle: Zero Dependencies

The entire pipeline—from Unicode scanner, Pratt parser, and bytecode compiler, to the register-free stack virtual machine, memory globals, symbol table, and terminal REPL—builds completely offline with go build. It guarantees 100% deterministic compilation across Termux (Android ARM64), Linux, macOS, and Windows.

Core Pillars

  • Clean, International English Syntax: Familiar to developers from Python, JavaScript, and Go, with no syntactic noise or forced ceremony.
  • 64-Bit Opcode Virtual Machine & Dynamic Stack: Every source program is compiled to dense 64-bit BigEndian binary opcodes executed by a high-throughput stack loop with dynamically expandable call frames.
  • Compile-Time Metaprogramming Sandbox: Evaluate precomputed constants, lookup tables, and loops at compilation (comptime { ... }) inlined directly into the bytecode constant pool.
  • Native Reactive Event Streams with Backpressure: Push/pull stream pipelines (std/stream) with demand signaling (request, pause, resume), time-windowed operators (debounce, throttle, window, sample), and combinators (merge, zip, concat, switch_map).
  • In-Memory Relational SQL & Columnar DataFrames: ANSI SQL parser, query planner, and execution engine (std/sql) with joins and aggregations, and high-performance zero-copy columnar vectors (std/dataframe).
  • Local AI Vector Metrics & Spatial KNN Index: Hardware-accelerated Cosine, Euclidean, Manhattan, and Dot similarity metrics, persistent spatial KNN vector index, and RAG sliding-window document chunking pipeline (std/ai).
  • Built-in Benchmarks, Fuzzing & Time-Travel Debugger: Integrated micro-benchmarks (bmd bench), mutation fuzz testing (bmd fuzz), and step-by-step reversible execution recording (bmd record & bmd replay).
  • Lightweight Actors & Supervision Trees: Erlang/OTP-inspired isolated process model with asynchronous mailboxes, synchronous ask, and fault-tolerant supervision trees (one_for_one, one_for_all, rest_for_one).
  • Monadic Safety & Algebraic Types: First-class Result (Ok/Err), Option (Some/None), and the postfix try-propagation operator (?) eliminating uncaught exceptions.
  • Uncolored Async/Await & Structured Concurrency: Non-viral async fn / await coroutines, cooperative multitasking (yield), and structured task groups with automatic cascade cancellation.
  • Fixed Tuples & Deep Pattern Matching: Immutable hashable tuples ((a, b, c)), multi-variable destructuring, and deep structural matching with boolean guards (match ... case ... if ...).
  • Enterprise Standard Library: Battery-included pure Go suites for datetime (std/datetime), filesystem (std/fs, std/path), data encoding (std/encoding), cryptography, networking, and mathematical analytics.
  • Zero Emojis Standard: Clean, professional developer diagnostics utilizing Unicode geometric symbols (✦, ❯, ·) and standard bracketed status badges ([OK], [INFO], [ERROR]).
  • First-Class Termux & ARM64 Support: Developed directly on Android mobile workstations with native performance.
Chapter 2

Quickstart, Installation & Global CLI (bramand / bmd)

BramandScript provides a unified native binary executable with aliases bramand and bmd. Pre-compiled standalone releases are automatically published for Android (Termux), Linux, macOS (Apple Silicon & Intel), and Windows via GitHub Actions.

1. Smart Universal Installer (Linux, macOS, Android Termux)

Run the smart installer one-liner. It auto-detects your OS (Linux, Darwin, Android Termux) and CPU architecture (amd64, arm64, armv7), pulls the latest release binary, and configures global symlinks:

bash — terminal
curl -fsSL https://raw.githubusercontent.com/Codeleafly/bramandScript/main/install.sh | bash

2. Windows PowerShell Installer

On Windows, open PowerShell and run:

powershell
irm https://raw.githubusercontent.com/Codeleafly/bramandScript/main/install.ps1 | iex

3. Manual Compilation with Local Go Toolchain

If you have the Go toolchain installed, clone the repository and compile directly without external dependencies:

bash — compilation
git clone https://github.com/Codeleafly/bramandScript.git
cd bramandScript
go build -ldflags="-s -w" -o bramand main.go

# Install to system PATH
cp bramand "${PREFIX:-/usr/local}/bin/bramand"
ln -sf "${PREFIX:-/usr/local}/bin/bramand" "${PREFIX:-/usr/local}/bin/bmd"

CLI Command Matrix

Command Description Example
bmd or bramand Launch interactive terminal REPL bmd
bmd run [-O] <file.bmd> Execute source file (optional -O for AOT optimizations) bmd run -O app.bmd
bmd run --allow-all <file.bmd> Run with unrestricted capabilities (exec, write, net) bmd run --allow-all server.bmd
bmd run --allow-run|--allow-write|--allow-net Run with granular capability grants bmd run --allow-net server.bmd
bmd run --max-frames <N> Configure custom call stack depth limit bmd run --max-frames 2048 app.bmd
bmd build [-O] <src> Compile standalone native binary bmd build -O app.bmd
bmd <file.bmd> Direct file execution shortcut bmd script.bmd
bmd test [paths] Run automated test suite discovery and execution runner bmd test tests/
bmd bench <file.bmd> Run micro-benchmarks with statistical timing and allocation tracking bmd bench bench.bmd
bmd fuzz <file.bmd> Run automated mutation-based fuzz testing engine bmd fuzz fuzz_test.bmd
bmd record <file.bmd> [-o trace.json] Record VM execution step checkpoints into time-travel trace bmd record app.bmd
bmd replay <trace.json> Interactive time-travel debugger with step forward and step backward bmd replay trace.json
bmd fmt [-c] [paths] Format source files or verify formatting with -c bmd fmt -c stdlib/
bmd version Print version and runtime platform architecture bmd version
bmd help Display unified CLI command overview bmd help
Chapter 3

REPL & In-Terminal Multi-Line :editor Mode

BramandScript includes a high-powered REPL equipped with intelligent multi-line block detection, brace balancing, runtime diagnostics, and a dedicated full-buffer terminal editor mode.

Interactive REPL Session

terminal — bmd repl
✦ BramandScript 0.1.2 (arm64-linux) · High-Performance Bytecode VM
  Type :help for documentation, :editor for multi-line, :exit to quit.

✦ bmd ❯ let greeting = "Hello, Universe!"
✦ bmd ❯ println(greeting)
Hello, Universe!
✦ bmd ❯ fn square(n) {
· ···     return n * n
· ···   }
✦ bmd ❯ square(12)
144

Built-in Multi-Line :editor Mode

When writing complex algorithms, structs, or functions in the REPL, type :editor (or :edit) to switch into multi-line buffered mode. Line numbers are automatically rendered. You can execute immediately with :done or write directly to disk with :done <filename.bmd>!

terminal — :editor mode
✦ bmd ❯ :editor fib.bmd
__________________________________________________________________
Multi-Line Editor Mode
Type code line-by-line. Type :done to execute, :cancel to abort.
To save to file on disk: :done <filename.bmd>
__________________________________________________________________
01 | fn fib(n) {
02 |   if n <= 1 { return n }
03 |   return fib(n - 1) + fib(n - 2)
04 | }
05 | println("Fib(10) =", fib(10))
06 | :done
[OK] Saved 108 bytes to fib.bmd
Executing buffer...
Fib(10) = 55

REPL Commands Reference

  • :editor — Launch multi-line editor buffer
  • :editor <file.bmd> — Open editor with an automatic save target
  • :clear — Clear terminal screen
  • :reset — Reset VM constant pool, symbol table, and global variable store
  • :help — Print language quick reference
  • :exit or :quit — Exit REPL