Favicon of Bend

Bend

Bend is a massively parallel language with a fast compiler, dependent types, and LAWS.bend for mathematically enforcing app rules.

Bend website screenshot
Bend GitHub repository preview

Bend is a high-level programming language designed to run in parallel across CPU cores and GPUs without threads, locks, or manual kernel code. It targets developers, especially those working with AI coding agents, who want a language precise enough to state intent unambiguously and a compiler that can mathematically verify that intent holds. The pitch centers on LAWS.bend, a file where you declare rules your app must never break, which the compiler checks via required proofs whenever code changes.

Bend compiles to C, Metal, CUDA, and JavaScript. Its type system is affine and dependent, which lets the compiler both generate fast native code and check formal proofs quickly. The project describes itself as young, with a compiler that is largely AI-written and not yet fully audited.

Key features

  • Automatic parallelism: split work into two calls and Bend spreads them across every available core (CPU or GPU) without explicit thread or lock management.
  • LAWS.bend: a mechanism for declaring rules ("winning is impossible", "balances must sum to zero") that the compiler enforces through required proofs on every code change.
  • Fast proof checking: the compiler checks proofs in under a second for files that other proof assistants take minutes to verify, according to the project's benchmarks.
  • Native performance target: aims to match hand-written C on a single core and outperform it with more cores, with full memory unification on GPU.
  • Python-like syntax with dependent types: familiar surface syntax combined with formal types and law/proof constructs.
  • Multiple compile targets: C, Metal, CUDA, and JavaScript, with Lua, Luau, and Python planned.
  • CLI tooling: bend guide prints the language guide, bend base prints the base library, and bend PROOF.bend runs proof checks.

Ideal use cases

Bend fits projects where an AI coding agent writes most of the implementation and you need a mechanical way to catch logic errors before they merge, such as game rule enforcement, invariant-heavy backend logic, or small proof-carrying utilities. It also suits experiments in parallel computation where you want a divide-and-conquer style program to spread automatically across CPU cores or a GPU without writing kernel code.

It's not a good fit for production systems needing mature tooling: there's no debugger, profiler, REPL, package versioning, or full editor support (only formatting, no completion or diagnostics). Text-heavy applications suffer too, since strings are linked lists of characters and processing is slow. Anything needing 64-bit numbers, TLS, JSON, regex, or HTTP out of the box will require writing foreign bindings yourself. Windows users need WSL, and the language currently supports one GPU per program with no multi-machine execution.

Installation

Install Bend with the provided install script:

curl -fsSL https://bend-lang.com/install.sh | sh

To have an AI agent use Bend correctly, add instructions to your AGENTS.md:

When using Bend:
- run `bend guide` to learn it
- use `LAWS.bend` to keep important rules
- run `bend PROOF.bend` before committing
- parallelize the code whenever possible

Then tell your agent "use Bend" and it can pick up the guide and conventions from there.

Bend works best on the back-end, on Linux or macOS. Compiling to native targets requires clang 14+ (19+ for GPU dispatch via !), and Metal or CUDA 12 for GPU targets. On Linux, windowing and audio effects need X11 and ALSA headers. For faster iteration during development, the JavaScript target is recommended over native compilation, which is slower due to clang/CUDA/Metal build times. Reference material includes GUIDE.md (also printed by bend guide), a demos/ folder with example apps and their LAWS.bend files, and the base.bend standard library.

Share:

Stars
23.8K
Forks
757
Last commit
2 days ago
Repository age
3 years
License
Apache-2.0
Self-hosted
No
Activity score
81/100
View Repository
Ad
Favicon

 

  
 

Similar to Bend

Favicon

 

  
 
Favicon

 

  
 
Favicon