Skip to content

Beans

A small programming language with explicit types, predictable ownership, and direct systems access.

Beans is a small, general-purpose programming language with explicit types, exact decimal arithmetic, and direct systems access. Source files end in .b.

You can write standalone functions and closures, define structs and enums, or use classes and interfaces. Classes support inheritance and reference semantics; structs copy by value. Missing values use Option and failures use Result, with no null or exceptions. Memory uses automatic reference counting with a cycle collector, and an unsafe layer provides raw memory and C interop.

One compiler, beansc, checks your program and either runs it on a reference interpreter or compiles it to a native binary through LLVM.

import std.io
fn main() {
let name: string = "beans"
io.println("hello from {name}")
}

Small and explicit

Every name states its type. There is no null and no exceptions: missing values are Option, failures are Result. The grammar is small.

Predictable memory

Automatic reference counting with a cycle collector. Destructors run when the last strong reference is released. The cycle collector handles unreachable reference cycles.

Systems access

Files, sockets, threads, atomics, SIMD, shared memory, dynamic libraries, and a full C ABI, all through the standard library.

One command

beansc is the checker, interpreter, native backend, package manager, language server, and debugger. One command installs it.