Batata · Experimental compiler

Elixir,
compiled, native.

A small compiler with grand ambitions. Batata carries a practical slice of Elixir through MLIR to efficient native code.

Front end
Elixir source
Compiler IR
MLIR / LLVM
Runtime
Zig
01 · SOURCE Elixir def main, do: 6 * 7
lower
02 · REPRESENTATION MLIR / LLVM %0 = arith.muli %6, %7
compile
03 · OUTPUT Native ./main  →  42

Small language. Grand performance.

01 / WHY BATATA

A compiler experiment you can inspect from syntax to silicon.

Batata explores what an Elixir-to-native pipeline looks like when every boundary is explicit: language subset, transformation, lowering, runtime ABI, and emitted artifact.

It is built with Beaver, the Slang-defined ex dialect, LLVM, and a compact Zig term runtime.

01

λ

Speak Elixir

Compile modules, functions, scalar expressions, selected terms, pattern matching, closures, and a deliberately bounded standard-library surface.

02

See the pipeline

Inspect the ex IR, information-preserving transforms, structured lowering, and the final LLVM representation.

03

Ship an artifact

Run through the MLIR JIT or emit an AOT static archive, C driver, symbol manifest, and digest-addressed export bundle.

02 / PIPELINE

One continuous lowering story.

Each stage has one job. Representation changes stay visible, unsupported forms fail explicitly, and semantic gates compare native results with a BEAM oracle.

01Elixir sourceexpanded module snapshot
02ex dialecttyped compiler boundary
03Transformsinformation-preserving IR
04LLVM + Zignative runtime boundary
05Native outputJIT or AOT bundle

03 / HONEST STATUS

Useful now. Explicitly incomplete.

Batata is active compiler research, not a drop-in BEAM replacement. The compatibility surface grows behind executable semantic gates.

Implemented slices

  • Scalar arithmetic and local calls ready
  • Tuple, list, map, and binary terms slice
  • Case, guards, and pattern plans slice
  • Kernel, Enum, String, and Base slice
  • JIT execution and AOT archives ready
  • Export bundles and upgrade diff early

Not promised yet

  • Full Elixir semantics not yet
  • Drop-in OTP compatibility not yet
  • Stable package installation not yet
  • Production support guarantees not yet
  • Cross-platform binary releases planned
  • Stable public compiler API evolving

04 / QUICKSTART

Start at the source.

Batata currently targets compiler contributors and early experimenters. You will need Elixir, OTP, Zig 0.16, and an LLVM/MLIR toolchain.

Open development setup
ShellDevelopment checkout
# Clone the compiler and its local dependencies
git clone https://github.com/batata-lang/batata.git
git clone https://github.com/beaver-lodge/beaver.git
git clone https://github.com/beaver-lodge/kinda.git

cd batata
export BEAVER_PATH=../beaver
export BEAVER_KINDA_PATH=../kinda

mix deps.get
mix test

Built in the open

Help grow the native edge of Elixir.

Read the compiler, test a language slice, or bring a precise unsupported case. Small, verifiable steps are the roadmap.