Axon Architecture Overview
Axon is designed from the ground up to solve the primary bottlenecks of modern AI-native applications: concurrency at scale, LLM code-generation efficiency, and raw execution speed.
Unlike Rust, which forces the developer to battle the borrow checker for memory safety, or Go, which uses a garbage collector that introduces unpredictable latency pauses, Axon uses a hybrid deterministic memory model paired with an ultra-lightweight actor concurrency system.
The Compiler Pipeline
Section titled “The Compiler Pipeline”Axon’s architecture relies on a highly modular compiler pipeline. Source files (.axs) are parsed into an Abstract Syntax Tree, lowered into an intermediate representation, and finally handed off to a backend.
Axon compiles directly to native machine code via LLVM for server-side execution, and to WebAssembly (WASM) for edge and browser environments.
This means you get the zero-cost abstractions of C++ with the deployment portability of JavaScript.
The Actor Model (Green Threads)
Section titled “The Actor Model (Green Threads)”Traditional OS threads are heavy. They require megabytes of stack space and expensive context switches. Axon implements a lightweight M:N Green Threading model, often called “Actors”.
In Axon, spawning a new actor takes only a few bytes of memory. You can comfortably spawn millions of actors on a standard laptop. They communicate exclusively via lock-free message passing, entirely eliminating data races and deadlocks.
Zero-Cost FFI
Section titled “Zero-Cost FFI”Because Axon compiles through LLVM and uses a C-compatible ABI by default, calling C libraries from Axon (or vice-versa) has exactly zero overhead. There is no JIT translation layer or managed boundary to cross.
;; Example: Calling a C function directly from Axon(module (extern puts ((s str)) i32)
(fn main () i32 (block (call puts "Hello from C, inside Axon!") (i32 0))))Homoiconicity & The AST
Section titled “Homoiconicity & The AST”Because Axon uses S-expressions, the code itself is a direct representation of the Abstract Syntax Tree (AST). This property, known as homoiconicity, makes parsing trivial and eliminates ambiguity.
Try parsing the code snippet below to see how directly the S-expressions map to the compiler’s internal AST:
Next, read our AI Philosophy to see how our S-expression syntax makes Axon the ultimate language for LLM-generated codebases.