Badger is a dataflow language, that aims to have source code ergonomics closer to languages like Rust or Zig. It uses strong types and immutable data structures.
Instead of step-by-step control flow, Badger programs are graphs of values and transformations that run when their inputs are ready. However, the syntax follows a familiar paradigm (and is heavily inspired by Rust and Haskell).
See spec/lang.md for the full language specification. examples/hello-world/main.badger and spec.badger contain runnable examples.
- Immutable, dataflow execution. A program is a graph; nodes fire when their inputs are ready. Independent subgraphs run in parallel with no ceremony.
- Effect cascading. Pure nodes (no effectful inputs) are freely reordered, memoized, or elided. Effectful nodes fire exactly as the graph dictates.
- Expression-oriented, Rust-shaped syntax.
struct,enum,interface,implement, pattern-matchingmatch, generics with<T>— familiar shapes with strong static typing. - No loops —
@recurseonly. Iteration is tail-recursive self-reference inside a function; nearest-enclosingfnscope. - Capability-passing for effects. The program entry point receives an
Initvalue; all IO and runtime access is threaded through it explicitly. Effects are also tracked in types (!effect(io)). - Ordering. Prefer data edges → capability threading (effectful functions return the capability) →
!dependas an escape hatch for explicit happens-before. - Runtime boundary. Capability interfaces declared in
.badger; the host crate provides implementations.
pub main = fn(init: Init) -> () {
init.stdout.print_line("Hello World");
};
- lib/ — Badger-level standard library (
.badgersources). - examples/ — Example Badger programs, one directory per example.
- crates/ — Rust crates implementing the toolchain (parser, graph IR, optimizer, runtime, interpreter, compiler, host). See crates/index.md for the full breakdown.
- spec/ — language specification and design docs.
Badger stands on the shoulders of giants. It borrows ideas from:
- Rust — syntax and type-system shape.
- Zig — explicit runtime boundaries and capability passing.
- Haskell — purity and effect tracking.
- TensorFlow — dataflow-graph execution.
Dual-licensed under MIT or Apache 2.0, at your option.
