Skip to main content

Deterministic business application platform optimized for AI-assisted development

Project description

AILang

AI-first programming language — deterministic, specification-driven, and compiler-friendly.

Tests Python Version License

AILang is an AI-first programming language designed to be deterministic, specification-first, and easy for both humans and AI systems to reason about. It features a complete compiler pipeline, a 16-module standard library, and has been validated through 894 tests, stress testing up to 10,000 LOC, and AI-generated program verification with 100% first-pass success.

Quick Start

# Install from PyPI
pip install ailang-lang

# Run your first program
echo 'fn main() { print("Hello, AILang!"); return 0 }' > hello.ail
ail hello.ail

Or install from source:

git clone https://github.com/akpersonal4/ailang-lang-AILang.git
cd ailang-lang-AILang
pip install -e .

# Run your first program
echo 'fn main() { print("Hello, AILang!"); return 0 }' > hello.ail
ail hello.ail

Core Commands

ail <file.ail>           # Run a program
ail fmt <file.ail>       # Format code (one style, no config)
ail fmt --check <file>   # Check if formatted
ail doctor               # Diagnose environment issues
ail context --json       # Get machine-readable language context
ail docs <NAME>          # Read documentation (AGENTS, LANGUAGE_SPEC, STDLIB_REFERENCE)
ail test <file_or_dir>   # Run tests
ail mcp                  # Start MCP server for AI tool integration

AI Agent Setup

For AI-assisted development, run this first:

# Get machine-readable language context
ail context --json

# Read the documentation
ail docs AGENTS
ail docs LANGUAGE_SPEC

Document hierarchy:

  1. LANGUAGE_SPEC.md — canonical language definition (authoritative)
  2. AGENTS.md — AI operational rules (derived from spec)
  3. AILANG_DEVELOPMENT_PLAYBOOK.md — coding patterns and conventions
  4. STDLIB_REFERENCE.md — library API documentation

If AGENTS.md conflicts with LANGUAGE_SPEC.md, the spec wins.

Language Tour

import string;
import math;
import list;

// Functions are top-level, recursion only (no loops)
fn factorial(n) {
    if (n <= 1) {
        return 1
    }
    return math.mul(n, factorial(math.sub(n, 1)))
}

// Import aliases
import map as m;

fn main() {
    // Variables with let
    let greeting = "Hello, AILang!";
    print(greeting);

    // Map operations
    let config = map.new();
    map.set(config, "version", "1.0");
    let v = map.get(config, "version");

    // Recursion
    let result = factorial(5);
    print(result);

    return 0
}

Documentation

Guide Description
Getting Started Step-by-step introduction
Language Tour Complete language feature tour
Standard Library Reference All 16 modules documented
MCP Quick Start AI tool integration via MCP
Compiler Architecture Pipeline and design
Contributor Guide How to contribute
Testing Guide Test patterns and practices
Quick Start 5-minute setup guide
VS Code Extension AILang VS Code extension

VS Code Extension

Install the AILang extension for syntax highlighting, snippets, bracket matching, and more:

code --install-extension extensions/vscode-ailang

Or package and install from the VS Code Marketplace: extensions/vscode-ailang/.

Features

  • Simple, explicit syntax — functions, variables, conditionals, recursion
  • Deterministic compilation — same source always produces same output
  • 16-module Standard Library — string, math, collections, file I/O, JSON, CSV, time, random, environment, conversion
  • AI-native toolingail mcp exposes compiler to AI tools via Model Context Protocol
  • AI-friendly — validated with 23 AI-generated programs at 100% first-pass success
  • Fast compile times — 5000 LOC compiles in <2 seconds
  • Low memory usage — 5000 LOC uses <11 MB peak memory
  • Complete test coverage — 931 tests across all compiler stages

Example

import string;
import math;
import list;

fn process(items) {
    let first = list.get(items, 0);
    return string.uppercase(first)
}

fn main() {
    let items = list.new();
    list.append(items, "hello");
    list.append(items, "world");
    let r = process(items);
    let s = math.add(1, 2);
    print(r, s);
    return 0
}

Standard Library

Module Operations
string concat, equals, uppercase, lowercase, length, contains, starts_with, ends_with, trim, substring, find, find_from, split, join, from_int, from_bool
math add, sub, mul, div, abs, min, max
list new, append, len, get, contains, remove, clear, sum, find_by_key, filter_by_key, filter_by_contains, collect_key, group_by_key, sum_by_key, take, skip, search_by_name, exists_by_key, sort, sort_by_key, copy
array new, push, len, get, contains, remove, clear
map new, set, get, has, delete, keys, clear, values, get_or_default, safe_get
set new, add, contains, len, remove, clear
file exists, read, write, append, remove, listdir
path join, basename, dirname, extension, normalize
json parse, stringify
csv parse, parse_header, stringify
time now, timestamp, sleep, format
random int, float, choice
environment get, cwd, args
convert to_string, to_int, to_bool, to_number
io write, writeln, println, read
system exit

Project Status

Metric Value
Python version 3.11+
Compiler LOC ~3,950 (39 Python files)
Stdlib modules 16
Tests 894 passing
Example programs 55+
Application programs 43+
DX Tools ail context, ail doctor, ail static_analyzer, ail benchmark, ail testgen, ail docs, ail mcp
Quality gates black, ruff, mypy all clean
Validation Deterministic, AI-verified, stress-tested

Formatter

AILang includes a deterministic source code formatter. One style only — no configuration.

# Format a file in-place
ail fmt hello.ail

# Check if a file is formatted (exit 0 = yes, 1 = no)
ail fmt --check hello.ail

# Read from stdin, write formatted to stdout
cat hello.ail | ail fmt --stdin

Formatting rules:

  • 4-space indentation
  • Opening brace on same line (fn foo() {, if (cond) {)
  • } else { on one line
  • Spaces around all binary operators (a + b, x == y, a && b)
  • Space after , in parameter/argument lists
  • Single blank line between function declarations
  • Trailing whitespace removed
  • Newline at EOF
  • Comments preserved — inline and standalone comments are retained

Formatting is idempotent: formatting an already-formatted file produces no changes.

Development

# Install development tools
pip install pytest black ruff mypy

# Run all quality gates
python -m pytest
black --check .
ruff check .
mypy

License

This project is licensed under the Apache License 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ailang_lang-1.0.7.tar.gz (297.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ailang_lang-1.0.7-py3-none-any.whl (236.3 kB view details)

Uploaded Python 3

File details

Details for the file ailang_lang-1.0.7.tar.gz.

File metadata

  • Download URL: ailang_lang-1.0.7.tar.gz
  • Upload date:
  • Size: 297.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for ailang_lang-1.0.7.tar.gz
Algorithm Hash digest
SHA256 9396e1412582cfeae4329d1ca6d5633c1736f71824a3b3caf183dd86f8878d1d
MD5 ad0c2f2053229a3124f3138f1b2d2de6
BLAKE2b-256 e32dcad3639956f5d2b60e4266f88c82e5c68d4105f6ce697579e4d6b0886de6

See more details on using hashes here.

File details

Details for the file ailang_lang-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: ailang_lang-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 236.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for ailang_lang-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 2ac5946075c26bb27cf26b1d79e0d86ebda41c1708873cf4ca26bb02c95f2a22
MD5 61b27b68aeb93a8dfe164e6188dd7543
BLAKE2b-256 56f040060c39c84d8f541d301bdce4b450a2279cae7f724a29785792beb261a3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page