Skip to main content
AILANG Logo

AILANG: AI-First Programming Language

Welcome to the official documentation for AILANG, a deterministic, effect-typed programming language designed as a safe target for AI-generated programs.

AILANG v0.16.2 ships a stable core — language, effects, modules, codegen — with APIs that may still evolve in pre-1.0 minor releases.

New to AILANG? Read our Vision to understand why AILANG exists and what makes it different from other programming languages.

What is AILANG?

AILANG is a pure functional programming language designed for AI-assisted development. Explicit effects, structured traces, and deterministic execution make AI-generated code easier to debug and verify.

Key features:

  • Pure Functional Core: Deterministic evaluation, referentially transparent
  • Algebraic Effects: Side effects declared in types (! {IO, FS, Net})—constrains what code can do
  • Structured Traces: Effect calls logged with typed inputs/outputs for debugging
  • Pattern Matching: ADTs with exhaustiveness checking catch invalid states at compile time
  • Inline Tests: Machine-readable specs that travel with code
  • Go Codegen: Compile to native performance with full type safety

Quick Example

Hello World

examples/runnable/hello.ail
-- hello.ail - Simple hello world program
module examples/runnable/hello

import std/io (print)

-- Entry module with exported main function
export func main() -> () ! {IO} =
print("Hello, AILANG!")

Run with: ailang run --caps IO examples/runnable/hello.ail

Recursive Factorial

examples/runnable/recursion_factorial.ail
-- recursion_factorial.ail
-- Demonstrates simple recursive function with LetRec
-- Status:Working (M-R4 recursion support)

module examples/runnable/recursion_factorial

import std/io (println)

-- Classic factorial using recursion
pure func factorial(n: int) -> int
tests [
(0, 1),
(1, 1),
(5, 120),
(10, 3628800),
(12, 479001600)
]
{
if n <= 1 then 1 else n * factorial(n - 1)
}

-- Tail-recursive factorial with accumulator
pure func factorialTail(n: int, acc: int) -> int
tests [
((0, 1), 1),
((1, 1), 1),
((5, 1), 120),
((10, 1), 3628800),
((12, 1), 479001600)
]
{
if n <= 1 then acc else factorialTail(n - 1, n * acc)
}

export func main() -> () ! {IO} {
let result1 = factorial(5);
let result2 = factorialTail(10, 1);

println("factorial(5) = ${show(result1)}");
println("factorialTail(10, 1) = ${show(result2)}")
}

Run with: ailang run --caps IO examples/runnable/recursion_factorial.ail

Where to next?

Pick the path that matches who you are. Each is a short funnel into the right 3–5 docs.

Current Status: v0.16.2

AILANG v0.16.2 is the latest stable release. Check the implementation status for complete details.

Core Features

  • Recursion - Self-recursion, mutual recursion, with stack overflow protection
  • Block Expressions - Multi-statement blocks with proper scoping
  • Records - Record literals, field access, subsumption
  • Type System - Hindley-Milner inference with type classes (Num, Eq, Ord, Show)
  • Pattern Matching - Constructors, tuples, lists, wildcards, guards
  • Module System - Cross-module imports, entrypoint execution
  • Effect System - IO, FS, Clock, Net, Declassify with capability-based security
    • Clock Effect: Monotonic time, sleep, deterministic mode
    • Net Effect: HTTP GET/POST with DNS rebinding prevention, IP blocking
    • Declassify Effect: Marks functions that lower an IFC label — every label change is auditable
  • Inline Tests - Test pure functions directly in code, ailang test
  • REPL - Full type checking, command history, tab completion
  • Lambda Calculus - First-class functions, closures, currying

Recent Additions (v0.16.2)

  • IFC Labels (v0.16.0) - Information-flow control at the type system. T<label> marks tainted sources; T{not LABEL} marks sinks that refuse them. Implements the language-feature half of Erik Meijer's Guardians of the Agents (CACM Jan 2026) — see the IFC labels guide and the prompt-injection benchmark
  • Tiered Eval Suite (v0.14.0) - smoke / core / stretch / vision tiers with a 12-tag taxonomy; Core tier is the headline AILANG-vs-Python metric (87.3% vs 81.0% on v0.12.0 baseline)
  • List-only ++ (v0.13.0) - String concatenation now goes through "${...}" interpolation, concat([...]), or join(sep, xs) — clearer error messages, ~82 fewer lines of compiler heuristics
  • Three-tier OTEL Tracing (v0.12.0) - --trace-tier off|standard|deep with span budgets and trace.truncated rollups
  • New Stdlib Modules (v0.12.0) - std/gzip, std/tar, plus 6.6× XLSX runtime speedup

Roadmap

  • Execution Profiles (v0.6.0) - Formal SimProfile, ServiceProfile, CliProfile with validation
  • Deterministic Tooling (v0.7.0) - normalize, suggest-imports, apply commands
  • Shared Semantic State (v0.6.0) - Multi-agent coordination via shared memory

See our Vision for the full roadmap and Roadmap for detailed plans.

Documentation Structure

  • Examples - Interactive code examples with explanations
  • Guides - Tutorials and how-to guides
  • Reference - Language specification and API docs
  • Playground - Try AILANG in your browser
  • Live Demos - 9 interactive browser demos (verification, streaming, AI agents)

Contributing

AILANG is open source and welcomes contributions! Visit our GitHub repository to:

  • Report issues
  • Submit pull requests
  • Join design discussions
  • Review the roadmap

Design Philosophy

AILANG is built on several key principles:

  1. Explicit Over Implicit: All effects and dependencies are visible in types
  2. Debuggability by Construction: Structured traces and effect boundaries make errors easy to localize
  3. AI-Optimized: Constrained syntax and explicit effects narrow the search space for valid code
  4. Deterministic: Same input always produces same output, enabling replay and caching
  5. Traceable: Effect calls logged with typed inputs/outputs for structured debugging

Read the full Vision to understand why AILANG is designed for the AI era.

Resources


AILANG is pre-1.0. The core language, effects, modules, and codegen are stable; minor-version releases may still adjust public APIs. See the Roadmap for what's next.