Skip to main content

AXON

The first programming language for AI with cognitive primitives, semantic types, and declarative reasoning. Compile to any model.

What is AXON?

AXON is a compiled language that targets LLMs instead of CPUs. It has a formal EBNF grammar, a lexer, parser, AST, intermediate representation, multiple compiler backends (Anthropic, OpenAI, Gemini, Ollama), and a runtime with semantic type checking, retry engines, and execution tracing. It is not a Python library, a LangChain wrapper, or a YAML DSL.
contract_analyzer.axon
persona LegalExpert {
    domain: ["contract law", "IP", "corporate"]
    tone: precise
    confidence_threshold: 0.85
    refuse_if: [speculation, unverifiable_claim]
}

anchor NoHallucination {
    require: source_citation
    confidence_floor: 0.75
    unknown_response: "Insufficient information"
}

flow AnalyzeContract(doc: Document) -> StructuredReport {
    step Extract {
        probe doc for [parties, obligations, dates, penalties]
        output: EntityMap
    }
    step Assess {
        reason {
            chain_of_thought: enabled
            given: Extract.output
            ask: "Are there ambiguous or risky clauses?"
            depth: 3
        }
        output: RiskAnalysis
    }
    step Check {
        validate Assess.output against: ContractSchema
        if confidence < 0.8 -> refine(max_attempts: 2)
        output: ValidatedAnalysis
    }
    step Report {
        weave [Extract.output, Check.output]
        format: StructuredReport
        include: [summary, risks, recommendations]
    }
}

Key Features

12 Cognitive Primitives

persona, flow, reason, anchor, validate, refine, memory, tool, probe, weave, context, intent

Epistemic Type System

Types represent meaning and cognitive state with partial order lattice

Multi-Model Compilation

Compile to Anthropic, OpenAI, Gemini, or Ollama backends

Runtime Self-Healing

Automatic retry with failure context for semantic validation

Quick Start

1

Install AXON

Install from PyPI with pip
pip install axon-lang
2

Write your first program

Create a .axon file with your cognitive flow
hello.axon
persona Assistant {
    tone: friendly
}

flow Greet(name: String) -> String {
    step SayHello {
        ask: "Say hello to {name}"
        output: String
    }
}
3

Compile and run

Execute with the AXON CLI
axon run hello.axon

Architecture Overview

AXON follows a traditional compiler pipeline with semantic validation:
.axon source → Lexer → Tokens → Parser → AST

                              Type Checker (semantic validation)

                              IR Generator → AXON IR (JSON-serializable)

                              Backend (Anthropic │ OpenAI │ Gemini │ Ollama)

                              Runtime (Executor + Validators + Tracer)

                              Typed Output (validated, traced result)

Explore the Documentation

Core Concepts

Learn about cognitive primitives and the type system

Language Reference

Complete syntax reference for AXON

CLI Reference

Command-line tools for compiling and running AXON

Architecture

Understand the compiler and runtime internals

Examples

Real-world examples and use cases

API Reference

Python API for programmatic usage

Why AXON?

Traditional programming languages were designed for deterministic machines. AI operates on probability, context, intention, and semantics. AXON provides primitives that match how AI thinks:
  • Declarative over imperative — describe what, not how
  • Semantic over syntactic — types carry meaning, not layout
  • Composable cognition — blocks compose like neurons
  • Configurable determinism — spectrum from exploration to precision
  • Failure as first-class citizen — retry, refine, fallback are native

Build docs developers (and LLMs) love