astra-lang.org

v0.9.1-alpha · 449 tests passing · prebuilt binaries for Linux, macOS & Windows

A language built for the way
code is written now.

Astra is a statically checked, natively compiled programming language designed for AI agents and the humans who supervise them. Code is generated, verified against machine-readable diagnostics, repaired, and compiled to a real executable — before it ever runs.

The loopVerify before you run

Most agent frameworks generate Python and discover mistakes at runtime — in production, in a sandbox, or in a retry loop that burns tokens. Astra moves that discovery to compile time and speaks to the agent in JSON.

agent → astra verify
$ astra verify --error-format=json bad.astra
{
  "success": false,
  "diagnostics": [{
    "phase": "typecheck",
    "error_code": "E0002",
    "message": "Undefined variable 'total'",
    "line": 4, "column": 12,
    "suggestion":
      "Declare 'total' with let before use"
  }]
}
fixed.astra → native binary
fn main() -> int {
    let total = 0;
    for i in 1..10 {
        total = total + i;
    }
    print("sum = ${total}");
    return 0;
}

$ astra compile fixed.astra -o sum
$ ./sum
sum = 45

The full cycle — generate → verify → read diagnostics → repair → compile → native executable — is the design center of the language, not a bolt-on.

Why it mattersFive things Astra does differently

D1 — Structured diagnostics as the agent interface

Every compiler error carries a stable error_code, source line/column, and a repair suggestion — in JSON. astra explain E0002 expands any code into a full explanation. Agents parse it; they don't scrape stderr.

D2 — Mistakes rejected before execution

Undefined names, type mismatches, arity errors, and bad returns are all caught by astra verify in ~100 ms — no code is generated, nothing runs.

D3 — Native speed through LLVM

Verified programs compile through LLVM IR to real machine code linked against a small C runtime. In a measured 5M-iteration loop, Astra's compile + run finished in 115 ms where Python's run alone took 959 ms.

D4 — Static by default, gradual where needed

The type system is strict, with inference so code stays terse. The dyn keyword opens a deliberate, marked boundary where checks defer to runtime — gradual typing on your terms.

D5 — Reproducible builds with Mifa

Mifa, Astra's package manager, writes a content-hashed astra.lock so the same inputs always produce the same dependency graph — and speaks JSON (--json) so agents can consume every command's result mechanically.

AudienceWho Astra is for

Agent & framework builders

You orchestrate LLMs that write code. You want generated code rejected before it runs, and compiler feedback your loop can parse mechanically. Start at the machine interface.

Engineers supervising AI output

You review more code than you write. A strict type system and explicit dyn boundaries mean the compiler has already audited what you're reading — you review intent, not typos.

Python developers hitting the ceiling

You like Python's surface but pay for it in runtime failures and slow loops. Astra keeps the terseness — inference, string interpolation, no lifetimes — and compiles to native.

Language & compiler enthusiasts

A readable Rust codebase (449 tests; source opens at v1.0-beta, early access on request) implementing a full pipeline: lexer → parser → type inference → LLVM IR → native. Every architecture decision is written down and ratified.

Astra is not aimed (yet) at kernel developers, hard real-time systems, or teams needing a mature ecosystem today — see the honest status below.

ParadigmStrategic language, tactical speed

In A Philosophy of Software Design, John Ousterhout draws the line between tactical programming — getting something working as fast as possible — and strategic programming — investing in design so the system stays changeable. LLMs are the ultimate tactical programmers: they produce working-looking code at machine speed, with no stake in the design surviving next week.

Astra's position: when generation is free, the strategic layer must move into the language. Types, contracts, Result-based errors, deterministic builds, and (soon) typed agent primitives are the design investment — enforced by the compiler, not by discipline. The agent supplies tactical speed; the language supplies strategic structure; the human supervises intent. That's the modern programming paradigm Astra is built for.

This isn't just positioning — each strategic guarantee is tracked and tested like a feature (5 of 11 shipped), and the release plan maps every version to the guarantee it adds.

HonestyWhat Astra is — and isn't — today

Astra is a public alpha compiler project. The core language compiles and runs natively with 449 tests green (0 ignored), but it is not yet a production language, a package ecosystem, or a memory-safe systems language. The progress page tracks exactly what works, what's partial, and what's planned — the same ground truth used inside the repo.

  • Works today: variables, functions, recursion, control flow, arrays, nominal structs, enums with payload variants + match, tuples + destructuring, Result<T,E> + the ? operator, try/catch (function-local), closures (defined and called), generic functions (monomorphized), impl blocks, bitwise ops, string interpolation, floats, async/await (sync lowering), REPL — all through the default LLVM-IR pipeline (--emit-ir, --target cross-compile, --legacy-c fallback). The compiler returns diagnostics instead of panicking on malformed input, and CI gates every commit on fmt, clippy, audit, and an llc IR-validity corpus
  • In progress: ARC memory reclamation — single-owner structs, strings, tuples, and arrays are freed at loop-body and function scope with retain-on-alias; string-aliased values still leak (bounded, safe)
  • Next: consolidating the two codegen paths, traits, generic structs, typed collections beyond a minimal Vec<int>, LSP alpha, astra fmt, stdlib core — full priority queue
  • Planned: agent-native keywords (tool, agent, prompt, memory), Python interop, WASM + GPU targets, hosted Mifa registry (protocol done, deployment pending)
  • Source availability: the compiler's source repository is private while the core hardens and opens at v1.0-beta. Binaries, examples, and the issue tracker are public at astra-releases; for early source access, get in touch

StartRun it in two minutes

Prebuilt astra + mifa binaries for Linux x64, macOS (Intel and Apple Silicon), and Windows x64 ship with each release, alongside the runnable showcase examples:

$ astra verify examples/showcase/01_hello_world.astra
Verification passed
$ astra compile examples/showcase/01_hello_world.astra --output hello
$ ./hello
Hello, World!

Requirements: LLVM tools (llc) and a C compiler (clang) on your PATH — the compiler calls them to produce native executables.