Skip to content

jonathannen/badger

Repository files navigation

Badger logo

Badger

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.

Language at a Glance

  • 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-matching match, generics with <T> — familiar shapes with strong static typing.
  • No loops — @recurse only. Iteration is tail-recursive self-reference inside a function; nearest-enclosing fn scope.
  • Capability-passing for effects. The program entry point receives an Init value; 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) → !depend as an escape hatch for explicit happens-before.
  • Runtime boundary. Capability interfaces declared in .badger; the host crate provides implementations.

Hello World

pub main = fn(init: Init) -> () {
  init.stdout.print_line("Hello World");
};

Repository Layout

  • lib/ — Badger-level standard library (.badger sources).
  • 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.
    • lang.md — language specification.
    • ir.md — intermediate representation (dataflow graph).

Giants

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.

License

Dual-licensed under MIT or Apache 2.0, at your option.

About

Badger is an immutable, dataflow-oriented programming language with strong static typing with syntax inspired by Rust and Zig.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages