AXON β€” AI-Native Programming Language

A compiler-first, AI-native programming language designed for AI models to write hyper-efficient native applications. Humans can't easily read or write it β€” that's the point.

S-Expressions C11 Compiler QBE Backend LLVM Backend Zero GC Cross-Platform

πŸ“– What is AXON?

AXON (AI-Native eXecution Optimized Notation) strips away everything designed for human ergonomics β€” meaningful variable names, syntax sugar, implicit conversions, flexible formatting. What remains is a minimal, unambiguous, fully-explicit notation that a language model can emit deterministically, and a compiler can transform into optimal machine code with zero guesswork.

The source format is S-expressions (.axs files) β€” a fully parenthesized prefix notation that eliminates parsing ambiguity. Phase 2 will introduce a binary AST format (.axb files) that removes lexing and parsing entirely.

✨ Key Features

βš™οΈ

Dual Backend

QBE IL for fast dev builds, LLVM IR for optimized release builds

🏷️

Enum Types

Nominal enums with explicit integer backing, eq/ne comparison, cast to int

🧬

Sum Types

Tagged unions with variant payloads, exhaustive matching, and payload extraction

πŸ”€

Pattern Matching

Exhaustive match on enums, sum types, bools, integers with wildcard fallback

πŸ”—

Function Pointers

First-class fnptr type with auto-coercion and indirect calls

πŸ“¦

Structs & Arrays

Value-type structs, fixed-size arrays with pointer access

🎯

Type-Safe Casting

Explicit cast between int↔int, float↔float, int↔float, enum↔int

🌍

Cross-Platform

macOS (ARM64) and Linux (x86_64 / ARM64)

⚑

Zero Runtime Overhead

No GC, no dynamic dispatch, no bounds checking overhead

πŸ”§ Compiler Pipeline

.axs text ──► Lexer ──► Parser ──► AST ──► TypeChecker ──► Typed AST ──► IR Lowering ──► AXON IR ──► (Optimizer) ──► QBE IL / LLVM IR ──► native binary

πŸ’‘ Featured Example

Enum types with exhaustive pattern matching β€” a key feature of AXON's type system.

enum_match.axs
(module
  (extern print_i64 ((n i64)) void)
  (enum Color i32 ((Red 0) (Green 1) (Blue 2)))

  (fn color_value ((c Color)) i64
    (match c
      ((Color Red)   (i64 10))
      ((Color Green) (i64 20))
      ((Color Blue)  (i64 30))))

  (fn main () i32
    (block
      (call print_i64 (call color_value (Color Red)))
      (call print_i64 (call color_value (Color Green)))
      (call print_i64 (call color_value (Color Blue)))
      (i32 0))))

Output: 10 20 30

πŸ“Š Project Stats

πŸ§ͺ
76
Tests Passing
πŸ“
~10,300
Lines of C
βš™οΈ
2
Backends
🌍
3
Platforms
Pipeline: passing
76/76 tests Β· QBE + LLVM backends Β· macOS & Linux CI

πŸ“ Project Structure

axon-lang/
β”œβ”€β”€ Makefile                 # Build system
β”œβ”€β”€ README.md                # Project overview
β”œβ”€β”€ .gitlab-ci.yml           # CI/CD pipeline
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ language-spec.md     # Complete language specification
β”‚   β”œβ”€β”€ ai-guide.md          # AI agent programming guide
β”‚   └── binary-format.md     # Binary AST format spec
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ axon.h               # Master header (types & interfaces)
β”‚   β”œβ”€β”€ main.c               # Compiler driver & CLI
β”‚   β”œβ”€β”€ arena.c              # Arena allocator
β”‚   β”œβ”€β”€ lexer.c              # S-expression lexer
β”‚   β”œβ”€β”€ parser.c             # S-expression parser β†’ AST
β”‚   β”œβ”€β”€ types.c              # Type system & checker
β”‚   β”œβ”€β”€ ir.c                 # IR construction & lowering
β”‚   β”œβ”€β”€ ast.c                # AST printer & utilities
β”‚   β”œβ”€β”€ emit_qbe.c           # QBE IL code generation
β”‚   └── emit_llvm.c          # LLVM IR code generation
β”œβ”€β”€ runtime/
β”‚   └── rt.c                 # Runtime library (print_i64, etc.)
└── tests/
    β”œβ”€β”€ programs/            # 65 program tests (.axs + .expected)
    └── errors/              # 11 error tests (.axs + .error)

πŸ—ΊοΈ Roadmap

Phase 1 β€” Foundation Current

S-expression parser, type system, type checker, SSA IR, QBE & LLVM backends, enums, sum types, pattern matching, function pointers, structs, arrays, constants, pointers, strings, float types.

Phase 2 β€” Type System Expansion Active

Generics (monomorphized), distinct types, optional types, closures, modules & imports, C callback support, trait system.

Phase 3 β€” Advanced Features

Binary AST format (.axb), linear types, region-based memory, GUI framework, package manager, standard library.