BPL is a statically-typed, compiled programming language that transpiles to LLVM IR. It combines the performance and control of systems languages with modern language features, making it ideal for performance-critical applications, systems programming, and educational purposes.
import [IO] from "std/io.bpl";
struct Point {
x: int,
y: int
}
frame main() ret int {
local p: Point;
p.x = 10;
p.y = 20;
IO.log("Hello from BPL!");
return 0;
}- LLVM Backend: Leverages LLVM's world-class optimization and code generation
- Zero-Cost Abstractions: High-level features without runtime overhead
- Manual Memory Management: Direct control over allocations for predictable performance
- Native Compilation: Produces optimized machine code for your platform
- Strong Static Typing: Catch errors at compile-time before they become runtime bugs
- Generics: Write reusable, type-safe code with full monomorphization
- No Null Dereferences: Explicit null handling patterns
- Type Inference: Less verbose where it matters, explicit where it helps
- Object-Oriented: Structs with methods, single and multiple inheritance
- Module System: Organize code with imports and exports
- Exception Handling: Try/catch blocks for robust error management
- Pattern Matching: Type-safe conditional logic
- Process execution: Execute shell commands, check status, and capture output with automatic injection protection
- String Interpolation: Embed expressions in strings with
`Hello ${name}` - Tuples: Multi-value types for clean APIs
- Function Pointers: First-class functions
- Clear Error Messages: Helpful compiler diagnostics with exact source-span underlines
- Machine-Readable Diagnostics: JSON output for
check,lint, anddoctorwith stable source ranges, source previews, and underline pointers for CI and editors - Enhanced Runtime Errors: Beautiful formatted error boxes with stack traces for null access, bounds checking, division by zero, and signed integer division overflow
- Built-in Formatter: Automatic code formatting and
format --checkfor CI gates - Watch Mode: Automatic recompilation on file changes for rapid development
- Package Manager: Easy dependency management with
bpl install - Cross-Platform: Compile for Linux, macOS, Windows, ARM, and more
- VS Code Extension: Full language server with IntelliSense, go-to-definition, hover tooltips, clickable imports, and smart stdlib path completions
- Incremental Compilation: Fast rebuilds with module caching
git clone https://github.com/pr0h0/bpl3.git
cd bpl3
./init.sh
bpl --versionYou'll need:
- Clang/LLVM (13+) - for compiling LLVM IR to native code
- Bun - for running the compiler
Linux (Ubuntu/Debian):
sudo apt-get install clang llvm lld
curl -fsSL https://bun.sh/install | bashmacOS:
brew install llvm lld
curl -fsSL https://bun.sh/install | bashWindows: Download LLVM from releases.llvm.org or use WSL.
bpl --version
echo 'extern printf(fmt: string, ...); frame main() ret int { printf("It works!\n"); return 0; }' > test.bpl
bpl run test.bplFor detailed installation instructions, see the Installation Guide.
Before publishing a local build or npm tarball, run:
bun run release:check
bun run release:manifestThe release check builds and tests the standalone compiler, packed CLI, runtime
artifacts, wasm runtime shims, shell completions, documentation, example
configs, and VS Code extension. The manifest command writes
dist/release-manifest.json with SHA-256 checksums for shipped artifacts.
Release manifest usage errors, such as
Unknown release manifest option: --unknown, Missing value for --out, or
Missing value for --repo-root, exit with status 2 before running release
manifest or npm pack work. Use bun tools/release_manifest.ts --help to print
the release manifest helper usage without writing artifacts.
Helper CLI inline value forms are supported for automation that prefers single-token options:
bun run ci:triage -- --json --jobs-json=jobs.json --run=<run-id> --repo=owner/repo
bun tools/release_manifest.ts --out=dist/release-manifest.json --repo-root=.Malformed inline values remain status 2 usage errors before network or release
work starts. ci:triage rejects --json=true and --jobs-json= before any
GitHub API request; release_manifest rejects --pack-npm=true and --out=
before writing manifests or running npm pack. test:ci rejects
--json=true, --list=true, --dry-run=true, and --help=true before
planning or running the CI-safe suite. Packed test:ci --list and
test:ci --json planning does not require a source-checkout tests/
directory. release:cli-registry rejects --check=true and --write=true
while keeping usage diagnostics on stderr. Focus those contracts with:
bun test tests/CiTriage.test.ts -t "inline option values|malformed inline option values"
bun test tests/ReleaseMetadata.test.ts -t "release manifest CLI reports usage errors|release manifest CLI accepts inline option values"
bun test tests/TestCiRunner.test.ts
bun test tests/JsonErrorCodeLists.test.tsPacked npm helper scripts supported from installed packages:
npm run fuzz:repro -- --help
npm run fuzz -- --help
npm run fuzz:replay -- --help
npm run fuzz:promote -- --help
npm run ci:triage -- --help
npm run ci:triage -- --json --jobs-json jobs.json <run-id>The packed fuzz, fuzz:replay, and fuzz:promote scripts validate usage in
installed packages before delegating to source-tree fuzz helpers when a checkout
is present. Fuzz helper usage diagnostics are status 2 failures before artifact
discovery, campaign startup, replay, promotion, or source-checkout delegation.
bun run fuzz:repro rejects flag values such as --json=true, empty artifact
options such as --input=, and mixed positional and --input artifact paths.
bun run fuzz rejects malformed boolean values such as --minimize maybe and
empty required values such as --iterations=. Focus these contracts with:
bun test tests/FuzzArtifactRepro.test.ts -t "malformed CLI option values"
bun test tests/CompilerFuzzRunner.test.ts -t "fuzz package wrappers reject malformed option values"
bun test tests/ReleaseHelperSmoke.test.ts -t "exercises packed helper usage paths"The package intentionally excludes source-only files such as
playground/examples/70-browser-wasm-showcase.json, tests/, fuzz/, and
broad compiler sources. The playground browser wasm helper assets are local
playground files, not npm package payload:
playground/frontend/wasmHostAdapter.js and
playground/frontend/browserWasmRuntime.js. The playground backend helper
modules used by the local web server are also source-only:
playground/backend/processRunner.ts,
playground/backend/nativeExecution.ts, and
playground/backend/wasmToolchain.ts, and
playground/backend/runtimeFiles.ts. The narrow exception is
compiler/common/PathSafety.ts, which is shipped because packed helper scripts
share its symlink-safe path validation.
Release metadata checks derive the helper inventory from package.json scripts
so new bun tools/*.ts npm scripts must be shipped or fail with the referencing
script name.
Packed ci:triage smoke also validates timeout repro contracts for package
tooling, package IR verification, and object symbol parsing:
BPL_PACKAGE_TOOL_TIMEOUT_MS=300000 bun test tests/PackageManager.test.ts
BPL_PACKAGE_IR_VERIFY_TIMEOUT_MS=30000 bun test tests/CLI.test.ts -t "package IR verification"
BPL_OBJECT_SYMBOL_TIMEOUT_MS=30000 bun test tests/ObjectFileParser.test.tsIt also validates representative JSON-code mapping repros from the packed helper path, including package archive validation and wasm linker diagnostics.
Packed ci:triage smoke also validates sanitizer runtime repro contracts:
bun run test:sanitizers
bun test tests/CompilerSanitizerRuntime.test.tsPacked package/import diagnostic smoke validates that the installed npm CLI
keeps package import JSON diagnostics machine-readable, including stable
diagnostic codes such as BPL_PACKAGE_MANIFEST_MISSING. Reproduce that release
slice locally with:
bun test tests/ReleaseMetadata.test.ts -t "packed package import diagnostic codes"
bun run release:smokeCreate hello.bpl:
extern printf(fmt: string, ...);
frame main() ret int {
printf("Hello, World!\n");
return 0;
}Compile and run:
bpl run hello.bplOr just compile:
bpl hello.bpl -o helloYou can compile snippets or piped input directly:
-
Compile a snippet from the command line:
bpl -e 'frame main() ret int { return 0; }' -
Compile from stdin (helpful with
cat/pipes):cat examples/hello-world/main.bpl | bpl --stdin
--emit tokens|ast|formatted|llvm works with both -e and --stdin; diagnostics show <eval>/<stdin> in locations.
Variables and Types:
extern printf(fmt: string, ...);
frame main() ret int {
local x: int = 42;
local name: string = "BPL";
local pi: float = 3.14159;
printf("%s: x = %d, pi = %f\n", name, x, pi);
return 0;
}Functions:
extern printf(fmt: string, ...);
frame add(a: int, b: int) ret int {
return a + b;
}
frame main() ret int {
local result: int = add(5, 3);
printf("5 + 3 = %d\n", result);
return 0;
}Structs and Methods:
extern printf(fmt: string, ...);
struct Point {
x: int,
y: int,
frame new(x: int, y: int) ret Point {
local p: Point;
p.x = x;
p.y = y;
return p;
}
frame print(this: Point) ret void {
printf("Point(%d, %d)\n", this.x, this.y);
}
}
frame main() ret int {
local p: Point = Point.new(10, 20);
p.print();
return 0;
}Generics:
extern printf(fmt: string, ...);
struct Box<T> {
value: T,
frame new(val: T) ret Box<T> {
local b: Box<T>;
b.value = val;
return b;
}
}
frame main() ret int {
local intBox: Box<int> = Box<int>.new(42);
local floatBox: Box<float> = Box<float>.new(3.14);
printf("Int: %d, Float: %f\n", intBox.value, floatBox.value);
return 0;
}Using Standard Library:
import [Array] from "std/array.bpl";
import [IO] from "std/io.bpl";
frame main() ret int {
local numbers: Array<int> = Array<int>.new(5);
numbers.push(10);
numbers.push(20);
numbers.push(30);
IO.log("Vector contents:");
local i: int = 0;
loop (i < numbers.len()) {
IO.printIntLn(numbers.get(i));
i = i + 1;
}
numbers.destroy();
return 0;
}For more examples, check out the examples directory or the Quick Start Guide.
Comprehensive documentation is available in the docs/ directory:
- Introduction - What is BPL and why use it?
- Installation - Setup guide for all platforms
- Quick Start - Write your first program in 5 minutes
- Syntax and Comments - Basic syntax rules
- Types and Variables - Type system and declarations
- Operators - All operators explained
- Control Flow - If, loop, switch statements
- Functions - Declaring and calling functions
- Structs - Custom data types
- Generics - Generic programming
- Pointers - Memory manipulation
- Arrays and Tuples - Collections
- Inheritance - OOP in BPL
- Module System - Organizing code
- Error Handling - Exception handling
- Standard Library - Built-in functionality
- Language Specification - Formal specification
- CLI Reference - All command-line options
- Standard Library API - Complete API reference
# Compile and run a program
bpl run main.bpl
# Development mode with watch and auto-run
bpl dev main.bpl
# Build an executable
bpl build main.bpl -o myprogram
# Type check without code generation (fast)
bpl check main.bpl
# Create a new project
bpl new my-project
# Format code
bpl format main.bpl -w
# Clean build artifacts
bpl cleanCompile and execute a BPL program in one step:
# Run a program
bpl run main.bpl
# Pass arguments to the program
bpl run main.bpl arg1 arg2
# Run with optimization
bpl run main.bpl -O 2
# Run with timing statistics
bpl run main.bpl --timeDevelopment mode with automatic recompilation and execution:
# Watch and run on changes
bpl dev main.bpl
# Clear screen on each recompile
bpl dev main.bpl --clear
# Watch but only compile (don't run)
bpl dev main.bpl --no-runExplicitly compile a program:
# Basic compilation (generates LLVM IR)
bpl build main.bpl
# Specify output filename
bpl build main.bpl -o myprogram
# Verbose output
bpl build main.bpl -v
# Enable incremental compilation
bpl build main.bpl --cacheFast type checking without code generation:
# Check a single file
bpl check main.bpl
# Check multiple files
bpl check src/*.bpl
# JSON output for tooling
bpl check main.bpl --jsonCreate a new BPL project with standard structure:
# Create new project
bpl new my-project
cd my-project
bpl run main.bplThis creates:
bpl.json- Package manifestmain.bpl- Entry point with Hello Worldlib/- Local library directoryREADME.md- Project documentation.gitignore- Git ignore rules
Remove build artifacts. In git repositories, tracked files are preserved even
when they live in build/, dist/, or .bpl-cache/. --json reports each
planned deletion as a file, directory, or symlink.
# Remove all build artifacts
bpl clean
# Dry run (show what would be deleted)
bpl clean --dry-run
# Verbose output
bpl clean -vThese work with any command:
-v, --verbose Enable verbose output
-q, --quiet Suppress non-error output
-O <level> Optimization level: 0, 1, 2, or 3
--debug, -d Generate DWARF debug information
--time Show compilation time statistics
--cache Enable incremental compilation
--color/--no-color Force/disable colored output
--json Output in JSON format (for check command)Control what the compiler outputs:
# Emit LLVM IR (default)
bpl build main.bpl --emit llvm
# Emit AST as JSON
bpl build main.bpl --emit ast
# Emit tokens
bpl build main.bpl --emit tokens
# Format source code
bpl format main.bplCompile for different platforms and architectures:
# Cross-compile for ARM64 Linux
bpl build main.bpl --target aarch64-unknown-linux-gnu --march=armv8-a
# Cross-compile for Windows x64
bpl build main.bpl --target x86_64-pc-windows-gnu
# Cross-compile for macOS ARM64
bpl build main.bpl --target arm64-apple-darwin
# Specify sysroot for cross-compilation
bpl build main.bpl --target aarch64-unknown-linux-gnu --sysroot /opt/sysroots/aarch64
# Pass additional flags to clang
bpl build main.bpl --clang-flag=-O3 --clang-flag=-staticSupported target triples:
x86_64-pc-linux-gnu(Linux x64)aarch64-unknown-linux-gnu(Linux ARM64)arm64-apple-darwin(macOS ARM64)x86_64-apple-darwin(macOS x64)x86_64-pc-windows-gnu(Windows x64)
# Format and print to stdout
bpl format main.bpl
# Format and write back to file
bpl format -w main.bpl
# Format multiple files
bpl format -w src/**/*.bpl# Initialize a new project
bpl init my-project
# Scaffold a new app project with machine-readable output
bpl new my-project --no-git --json
# Create a package tarball
bpl pack
# Install a package
bpl install package-name-1.0.0.tgz
# Install all dependencies from bpl.json
bpl install
# List installed packages
bpl list
# Uninstall a package
bpl uninstall package-nameSee the Package Management Guide for details.
BPL provides command-line completion for Bash and Zsh shells:
# Generate Bash completion script
bpl completion bash > ~/.local/share/bash-completion/completions/bpl
# Or add to your ~/.bashrc:
source <(bpl completion bash)
# Generate Zsh completion script
mkdir -p ~/.local/share/zsh/completions
bpl completion zsh > ~/.local/share/zsh/completions/_bpl
# Add to ~/.zshrc:
fpath=(~/.local/share/zsh/completions $fpath)
# Reload completions
rm -f ~/.zcompdump; compinitAfter installation, you can use Tab to complete commands, flags, and file paths!
BPL features a rich, safe type system:
- Primitive types:
int,float,bool,char - Composite types: pointers, arrays, tuples
- User-defined types: structs with fields and methods
- Generics: Type parameters for functions and structs
- Type aliases: Create meaningful names for complex types
type UserID = int;
type Callback = Func<void>(int);
type Point3D = (float, float, float);
struct Result<T, E> {
ok: T,
err: E,
is_ok: bool
}Manual memory management with safety helpers:
extern malloc(size: i64) ret *void;
extern free(ptr: *void);
frame main() ret int {
# Allocate
local ptr: *int = cast<*int>(malloc(sizeof(int) * 10));
# Use
ptr[0] = 42;
# Free
free(cast<*void>(ptr));
return 0;
}Single and multiple inheritance supported:
struct Animal {
name: string,
frame speak() { printf("...\n"); }
}
struct Dog : Animal {
breed: string,
frame speak() { printf("Woof!\n"); } # Override
}
struct Bird : Animal {
wingspan: float
}
# Multiple inheritance
struct Platypus : Animal, Swimmer {
# ...
}Organize code across files:
# math.bpl
export add, multiply;
frame add(a: int, b: int) ret int {
return a + b;
}
frame multiply(a: int, b: int) ret int {
return a * b;
}# main.bpl
import add, multiply from "./math.bpl";
frame main() ret int {
local sum: int = add(5, 3);
local product: int = multiply(5, 3);
return 0;
}BPL includes a comprehensive standard library:
| Module | Description | Example |
|---|---|---|
std/io.bpl |
Input/output operations | IO.log("Hello") |
std/string.bpl |
String manipulation | String.new("text") |
std/array.bpl |
Dynamic arrays | Array<int>.new(10) |
std/map.bpl |
Hash maps | Map<K, V>.new() |
std/set.bpl |
Hash sets | Set<T>.new() |
std/fs.bpl |
File system ops | FS.readFile(path) |
std/math.bpl |
Math functions | Math.sqrt(x) |
std/time.bpl |
Time operations | Time.now() |
std/json.bpl |
JSON parsing | JSON.parse<T>(str) |
std/option.bpl |
Optional values | Option<T>.Some(val) |
std/result.bpl |
Error handling | Result<T, E> |
std/ and std\ imports are reserved for the configured standard library and
do not fall back to packages or extra search paths when a normalized standard
library module is missing.
See the Standard Library documentation for complete API reference.
bpl3/
βββ compiler/ # Compiler implementation
β βββ frontend/ # Lexer (Peggy) and parser
β βββ middleend/ # Type checker, module resolver, linker
β βββ backend/ # LLVM IR code generation
β β βββ codegen/ # Generators for expressions, types, etc.
β βββ formatter/ # Code formatter
β βββ linter/ # Code linting
β βββ docs/ # Documentation generator
β βββ common/ # Shared utilities
β βββ AST.ts # AST definitions
β βββ CompilerError.ts # Error handling
β βββ Config.ts # Centralized configuration
β βββ Logger.ts # Structured logging
β βββ ... # Path resolution, source management
βββ cli/ # Command-line interface
β βββ index.ts # CLI entry point
β βββ commands/ # Subcommand handlers
β βββ completions/ # Shell completions
βββ docs/ # Comprehensive documentation
β βββ 01-introduction.md
β βββ 02-installation.md
β βββ 03-quick-start.md
β βββ ... # 70+ documentation files
βββ examples/ # 450+ examples and regression programs
β βββ hello-world/
β βββ fibonacci/
β βββ generics/
β βββ stdlib_*/ # Standard library examples
β βββ ...
βββ grammar/ # PEG grammar definitions
β βββ bpl.peggy # Language grammar
βββ lib/ # Standard library
β βββ io.bpl # Input/output
β βββ array.bpl # Dynamic arrays
β βββ map.bpl # Hash maps
β βββ string.bpl # String utilities
β βββ ... # 50+ stdlib modules
βββ tests/ # Comprehensive test suite
β βββ Integration.test.ts
β βββ Parser.test.ts
β βββ ...
βββ benchmark/ # Performance benchmarks
βββ vscode-ext/ # VS Code extension
βββ playground/ # Web playground (optional)
βββ index.ts # Main entry point
βββ LANGUAGE_SPEC.md # Language specification
βββ README.md # This file
The examples/ directory contains 450+ working examples and regression programs demonstrating language features and compiler edge cases:
hello-world/- Your first programassignment_variations/- Variable declarations and assignment formsfloat_operations/- Floating-point arithmeticcontrol_flow_if_complex/- Conditionalsloops/- Loop constructs
func_nested_calls/- Function definitions and callsstructs/- Custom data typesarrays/- Array operationspointers/- Pointer manipulationstdlib_string_extended/- String handling
generics/- Generic programminggenerics_advanced/- Complex genericsobjects_inheritance/- OOP patternsmulti_inheritance/- Multiple inheritanceerror_handling/- Exception handling
stdlib_demo/- I/O, arrays, strings, and stdlib basicsstdlib_vec/- Dynamic arraysstdlib_map_set/- Hash maps and setsstdlib_json/- JSON parsingstdlib_fs/- File systemstdlib_time/- Time operations
fibonacci/- Fibonacci sequencecollatz/- Collatz conjecturerecursive_algorithms/- Recursion examples
Each example includes:
- Source code (
.bplfiles) - Expected output (in test configurations)
- Build and test scripts
Run any example:
cd examples/fibonacci
bpl run main.bplActive BPL implementation work is tracked on the project-scoped BPL Agent Board.
Use the board as the source of truth for task ownership, acceptance criteria,
progress notes, review status, and time tracking. Keep repository artifacts in
sync with the board: user-visible behavior changes should update
CHANGELOG.md, docs should change with documented behavior, and completed work
should include the relevant test or verification output in the board summary.
Do not commit Agent Board credentials, API keys, local environment files, or private endpoint details. Board updates should describe the work and evidence, not secrets.
# Run the default test suite
bun run test
# Run the CI-safe broad suite. This includes integration, playground, VS Code
# extension tests, and a generated CLI registry shim check, but leaves
# correctness corpora, long fuzz, sanitizer runtime, and full release smoke
# suites to dedicated scripts.
bun run test:ci
# Inspect the typed CI-safe runner plan without running it.
bun tools/test_ci.ts --list
bun tools/test_ci.ts --dry-run
bun tools/test_ci.ts --json
bun tools/test_ci.ts --help
# Unknown test_ci options and malformed flag values such as --json=true exit
# with status 2 on stderr while stdout stays empty. Packed --list/--json
# planning works even when the installed package has no tests/ directory.
# CI-safe unit discovery includes tests/CiTriage.test.ts, including offline
# jobs-json diagnostics. Focus that path directly when needed:
bun test tests/CiTriage.test.ts -t "unreadable and malformed jobs-json"
# Run the generated packed CLI registry shim check directly.
bun run release:cli-registry
bun tools/cli_json_registry_shim.ts --help
bun tools/cli_json_registry_shim.ts --write
# Malformed registry-shim flag values such as --check=true and --write=true
# exit with status 2 before checking or writing generated files.
# Limit integration/example concurrency. BPL_INTEGRATION_JOBS must be a
# positive integer; malformed values are ignored with a warning and the
# auto-detected integration job count is used.
BPL_INTEGRATION_JOBS=4 bun run test:ci
# Check the integration runner environment contract directly.
bun test tests/IntegrationRunner.test.ts
# Build, pack, install, and smoke-test the release package. This also discovers
# package scripts that call tools/*.ts and verifies those helper files are in the
# packed npm tarball.
bun run release:smoke
# Run the focused packed-helper sweep without the full release package smoke.
bun test tests/ReleaseHelperSmoke.test.ts
# Summarize a GitHub Actions run and print local repro commands for failed steps.
bun run ci:triage -- https://github.com/pr0h0/bpl3/actions/runs/<run-id>
# Accepted locators are a numeric run id, a run URL, or a job URL.
bun run ci:triage -- <run-id>
bun run ci:triage -- https://github.com/pr0h0/bpl3/actions/runs/<run-id>/job/<job-id>
# Malformed run ids, malformed URLs, non-GitHub URLs, non-actions URLs, and
# invalid job ids fail as usage errors before any GitHub API request.
# For non-default repositories, --repo must be owner/name. Invalid values fail
# as usage errors before any GitHub API request.
# If a failed job prints "No focused local repro command matched this job",
# inspect the failed step logs and add a ci:triage mapping when the failure
# pattern is recurring.
# Print versioned JSON from a saved GitHub jobs API response without network.
bun run ci:triage -- --json --jobs-json jobs.json <run-id>
# Missing, malformed, or wrong-shape --jobs-json fixtures fail before any
# GitHub API request and name the fixture path in the usage error.
# Print CI triage usage without making a GitHub API request.
bun run ci:triage -- --help
# Wasm/toolchain failures include required-linker mode and doctor diagnostics.
bun index.ts doctor --json
# Run only the VS Code extension tests
bun run test:vscode-ext
# Run parser/typechecker/codegen tests that are safe on Windows runners.
# This validates documented target triples without native runtime execution.
bun run test:codegen-cross-platform
# Run compiler correctness and deterministic fuzz regression coverage
bun run test:correctness
# Run standalone/hosted WebAssembly runtime and toolchain contract coverage
bun run test:wasm
# CI sets BPL_REQUIRE_WASM_LD=1 so this fails instead of skipping when wasm-ld is missing.
BPL_REQUIRE_WASM_LD=1 bun run test:wasm
# Start the playground. The Run Wasm button compiles hosted wasm and executes it
# in the browser with JavaScript host imports.
cd playground && bun run start
# Run sanitizer-backed runtime checks. CI installs compiler-rt so this runs
# safe programs and checked failure paths under ASan/UBSan; local toolchains
# without sanitizer runtimes are detected.
bpl doctor sanitizer --json
bun run test:sanitizers
SANITIZER_RUNTIME_TEST_TIMEOUT_MS=30000 bun test tests/CompilerSanitizerRuntime.test.ts
# Run a short deterministic O0/O3 differential fuzz campaign. Differential
# inputs include successful programs and checked BPL runtime failures.
bun run fuzz:differential
# Validate saved active fuzz failures under tests/fuzz-failure-artifacts
bun run fuzz:validate-artifacts
# Print local replay/minimize/promote commands for downloaded scheduled fuzz artifacts
bun run fuzz:repro -- fuzz/crashes
# Save minimized fuzz artifacts while running a campaign
FUZZ_MINIMIZE=1 FUZZ_MINIMIZE_PASSES=8 bun run fuzz:differential
# Replay one artifact through parser, typechecker, codegen, runtime,
# O0/O3 differential, and sanitizer modes
bun run fuzz:replay -- --metadata fuzz/crashes/mismatch_seed-...json --mode parser,typecheck,codegen,runtime,differential,sanitizer
# Run specific test file
bun test tests/Integration.test.ts
# Run tests matching pattern
bun test -t "generics"# Check TypeScript types
bun run check# Build executable
bun run build
# Development mode (no build)
bun index.ts run examples/hello-world/main.bplContributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests (
bun test) - Format code (
bun run format) - Commit (
git commit -m 'Add amazing feature') - Push (
git push origin feature/amazing-feature) - Open a Pull Request
Open a pull request after running the relevant tests and type checks.
- Start with the Quick Start Guide
- Read the Language Specification
- Explore example programs
- Check the Standard Library docs
Coming soon!
- GitHub Discussions - Ask questions, share projects
- GitHub Issues - Report bugs, request features
- Discord - Real-time chat (link coming soon)
BPL is under active development. The compiler has 1,300+ tests across 140+ test files, plus hundreds of example and regression programs.
Build Status:
- β 1,300+ tests in the checked-in test suite
- β CI-safe suite includes integration tests, all playground examples, and VS Code extension tests
- β 0 ESLint errors/warnings
- β 0 TypeScript errors
- β 450+ checked-in examples and regression programs
- Full LLVM IR backend
- Static type system with generics
- Structs with inheritance
- Module system with imports/exports
- Exception handling (try/catch)
- Package manager
- Code formatter
- Cross-compilation support
- Standard library (50+ modules)
- VS Code extension
- Comprehensive test suite (1,300+ tests)
- Documentation (70+ pages)
- Enum types with pattern matching
- String interpolation
- Lambda expressions
- Tuple destructuring (including nested)
- Operator overloading (24 operators)
- Intrinsics (math, bit manipulation, memory)
- WebAssembly target (freestanding wasm32 plus hosted runtime hooks)
- IDE integrations (beyond VS Code)
- More stdlib modules (networking, threads)
- Optimization passes
- Package registry
- Incremental compilation improvements
- Inline assembly improvements
- C++ interop improvements
- Self-hosting compiler
See TODO.md for detailed task list.
BPL produces C-class performance on the checked-in benchmark suite. Representative medians from a recent --language bpl,c --runs 5 run:
| Benchmark | BPL (-O3) | C (clang -O3) | Ratio |
|---|---|---|---|
bit_twiddle |
40.60ms | 40.59ms | 1.00x |
fibonacci_recursive |
289.29ms | 317.60ms | 0.91x |
matrix_multiplication |
16.56ms | 17.06ms | 0.97x |
prime_sieve |
18.33ms | 21.17ms | 0.87x |
Run ./benchmark/run_all.sh --language bpl,c --runs 5 to refresh local numbers, or add --json > benchmark/latest-results.json to write ignored local JSON output.
| Feature | BPL | C | C++ | Rust | Go |
|---|---|---|---|---|---|
| Manual memory mgmt | β | β | β | β * | β |
| Generics | β | β | β | β | β |
| Inheritance | β | β | β | β | β |
| Exceptions | β | β | β | β | β |
| Module system | β | β | β | β | |
| Package manager | β | β | β | β | |
| Memory safety** | β | β | β | β | |
| Learning curve | ββ | ββ | βββββ | ββββ | ββ |
| Compile speed | β‘β‘ | β‘β‘β‘ | β‘ | β‘ | β‘β‘β‘ |
| Runtime performance | β‘β‘β‘ | β‘β‘β‘ | β‘β‘β‘ | β‘β‘β‘ | β‘β‘ |
*Rust uses ownership/borrowing instead of GC
**Planned for BPL
BPL is licensed under the Apache License 2.0.
See LICENSE for details.
pr0h0
- GitHub: @pr0h0
- Email: contact via GitHub
- LLVM Project - For the amazing compiler infrastructure
- Bun - For the fast JavaScript runtime
- Community Contributors - For bug reports and feature requests
Need help?
- Documentation - Check the docs/ directory
- Examples - Browse examples/
- Issues - Search or create a GitHub Issue
- Discussions - Join GitHub Discussions
- GitHub Repository: https://github.com/pr0h0/bpl3
- Documentation: docs/
- Examples: examples/
- Language Spec: LANGUAGE_SPEC.md
Happy Coding! π
BPL - Where performance meets modern language design