The world's first programming language built for LLMs and AI Agents
Magpie is an experimental, deterministic language with explicit ownership, ARC-managed lifetimes, and canonical formatting designed exclusively to be written and read by AI.
module demo.main
exports { @main }
imports { }
digest "8a5f3...91b"
fn @main() -> i64 {
bb0:
%res: i64 = call @compute {}
ret %res
}
Engineered for Attention
Every language feature optimizes for Transformer context windows, attention span, and deterministic generation.
Token Budgets
The compiler enforces hard limits on diagnostic and graph outputs, ensuring your agent's context window is never unexpectedly flooded.
CSNF Formatting
Canonical Source Normal Form (CSNF) rewrites code to a deterministic, singular token layout, eliminating format drift over edits.
ARC + Ownership
Predictable ARC-managed heap lifetimes combined with Rust-like borrowing constraints guarantee memory safety without GC pauses.
Explicit SSA Syntax
No hidden control flow, no operator overloading, and explicit basic blocks mean agents never have to guess what your code actually does.
No Surprises. Just Explicit Semantics.
Magpie's surface syntax is heavily inspired by LLVM IR, minimizing ambiguity for AI code generators.
fn @calculate_score(%base: i32, %bonus: i32) -> i32 {
bb0:
%total: i32 = i.add { lhs=%base, rhs=%bonus }
%is_high: bool = icmp.sgt { lhs=%total, rhs=const.i32 100 }
cbr %is_high bbHigh bbLow
bbHigh:
%capped: i32 = const.i32 100
ret %capped
bbLow:
ret %total
}
define i32 @calculate_score(i32 %base, i32 %bonus) {
bb0:
%total = add i32 %base, %bonus
%is_high = icmp sgt i32 %total, 100
br i1 %is_high, label %bbHigh, label %bbLow
bbHigh:
ret i32 100
bbLow:
ret i32 %total
}
Ready to build for the future?
Download the compiler, read the spec, and start creating deterministic programs today.