A contract-verified systems programming language.
Hard to write. Hard to get wrong. And that's what AI prefers.
Traditional languages prioritize human convenience—readable syntax, flexible conventions, implicit behaviors. The cost: ambiguity, guesswork, runtime surprises.
BMB takes a different approach. Contracts are mandatory. Specifications are explicit. Invariants are verified at compile time.
fn binary_search(arr: &[i64], target: i64) -> i64
pre is_sorted(arr)
post ret == -1 || (0 <= ret && ret < len(arr))
post ret != -1 implies arr[ret] == target
= {
var lo = 0;
var hi = len(arr) - 1;
while lo <= hi
invariant 0 <= lo && hi < len(arr)
{
let mid = lo + (hi - lo) / 2;
if arr[mid] == target { mid }
else if arr[mid] < target { lo = mid + 1; }
else { hi = mid - 1; }
};
-1
};
| Priority | Principle |
|---|---|
| P0 | Performance — No syntax that constrains optimization. Target: exceed C/Rust. |
| P0 | Correctness — If it can be verified at compile time, it must be. |
# Build
cargo build --release
# Run
bmb run examples/hello.bmb
# Type check
bmb check examples/simple.bmb
# Contract verification (requires Z3)
bmb verify examples/contracts.bmb
# Native compile (requires LLVM)
bmb build examples/hello.bmb -o hello
# REPL
bmb repl| Category | Status |
|---|---|
| Language Core | ✅ Complete |
| Type System | ✅ Complete |
| Contract System | ✅ Complete |
| Bootstrap Compiler | ✅ 30K LOC |
| Test Suite | ✅ 1,753+ tests |
| Documentation | ✅ Complete |
| CI/CD | ✅ Complete |
| Performance | ✅ 0.89x-0.99x vs C |
| Self-Compile | ✅ 0.56s |
| v1.0.0-beta | 🎯 Target |
- Types: i8-i128, u8-u128, f64, bool, char, String
- Generics:
<T>,<K, V>, bounds, where clauses - Contracts:
pre,post,invariant,where,pure,@trust - Control Flow: if-else, match, while, for-in, loop
- Operators: Arithmetic, overflow-safe (
+%,+|,+?), bitwise (band,bor), shift (<<,>>) - Collections: Vec, Box, HashMap (stdlib)
- Tooling: Package manager (gotgan), VS Code, formatter, LSP
- 3-Stage self-hosting verification (WSL)
- Performance Gate #3.2, #3.3 (Benchmarks Game, Contract optimization)
- Ecosystem packages (14+ target, 12 complete)
lang-bmb/
├── bmb/ # Rust compiler (being replaced)
├── bootstrap/ # Self-hosted BMB compiler (30K LOC)
├── stdlib/ # Standard library
├── examples/ # Example programs
├── ecosystem/ # Tools & extensions
│ ├── gotgan/ # Package manager
│ ├── vscode-bmb/ # VS Code extension
│ ├── tree-sitter-bmb/ # Syntax highlighting
│ ├── playground/ # Online editor
│ └── benchmark-bmb/ # Performance suite
└── docs/ # Documentation
| Requirement | Purpose | Required |
|---|---|---|
| Rust 1.70+ | Build compiler | Yes (until v0.45) |
| LLVM 21+ | Native codegen | Optional |
| Z3 | Contract verification | Optional |
| Document | Description |
|---|---|
| SPECIFICATION.md | Language specification |
| LANGUAGE_REFERENCE.md | Complete reference |
| ARCHITECTURE.md | Compiler internals |
| ROADMAP.md | Development roadmap |
| API_STABILITY.md | API guarantees |
| BENCHMARK_COMPARISON.md | C/Rust/BMB performance |
| tutorials/ | Getting started guides |
v0.46 (Current) ─── Independence (3-Stage verification)
│
v0.47 ─────────── Performance Gates (C parity verified)
│
v0.48 ─────────── Ecosystem (14+ core packages)
│
v0.49 ─────────── Samples & scenarios
│
v0.50 ─────────── Final verification
│
v1.0.0-beta ───── Complete programming language ★
See ROADMAP.md for detailed phases.
BMB matches or exceeds C/Rust performance on compute-intensive workloads:
C Rust BMB Winner
─────────────────────────────────────────────────────────
fibonacci(45) 1.65s 1.66s 1.63s ★ BMB (0.99x)
fibonacci(40) 177ms 180ms 150ms ★ BMB (0.85x)
mandelbrot 42ms 42ms 39ms ★ BMB (0.93x)
spectral_norm 44ms 44ms 39ms ★ BMB (0.89x)
self-compile - - 0.56s ✅ (30K LOC)
See BENCHMARK_COMPARISON.md for detailed methodology and results.
MIT