AAYU Language Specification v1.5.0

The AAYU Language

A self-hosted, intent-first programming language with built-in database models, ASGI web routing, reactive UI widgets, and zero external runtime dependencies.

Self-Hosted Ecosystem

The Lexer, Parser, AST Analyzer, and Standard Libraries are written in 100% pure AAYU (.aayu).

Silicon Stack VM

A high-performance stack VM written strictly in Rust executes bytecode instructions with C-level speed and zero runtime overhead.

Mobile & Termux Ready

Built statically with zero dependencies. Runs effortlessly on desktop Windows/Linux and Android Termux smartphones.

01.Values, Types & Memory Architecture

AAYU uses dynamic typing backed by an in-memory NaN-boxing union layout. Primitive values (integers, floats, booleans) fit in a single 64-bit register without heap allocation. When integer arithmetic exceeds the signed 48-bit register boundary, the VM automatically promotes values to 128-bit heap BigInts without silent wrapping or precision loss. Collections and strings allocate on the managed mark-and-sweep heap.

types.aayu
let count = 42              // Int (48-bit inline register)
let price = 19.99           // Float
let is_active = 1           // Bool (1 / 0)
let title = "Silicon Core"  // String
let empty = null            // Null
let numbers = [1, 2, 3]     // Array
let config = {"debug": 0}   // Dict

// 128-bit BigInt Auto-Promotion (Zero Wrapping)
let large_int = 140737488355327
let safe_sum = large_int + 1        // 140737488355328 (Auto-promoted to 128-bit BigInt)

// Runtime Type Reflection
print("count is:", type(count))        // "Int"
print("safe_sum is:", type(safe_sum))  // "Int"
print("title is:", type(title))        // "String"
print("numbers is:", type(numbers))    // "Array"

02. Multi-Line Triple Strings

AAYU natively supports Python-style multi-line string literals enclosed in triple-quotes ("""..."""). Newlines, tabs, and indentation inside the block are preserved verbatim.

multiline.aayu
let poetry = """Twinkle, twinkle, little star,
How I wonder what you are!
Up above the world so high,
Like a diamond in the sky."""

print(poetry)

03.Conditionals & Loops

Clean, keyword-delimited blocks without parentheses or braces. Every control block terminates with end.

control_flow.aayu
// 1. Conditionals (if / elif / else / end)
let score = 88

if score >= 90
    print("Grade: A")
elif score >= 80
    print("Grade: B")
else
    print("Grade: C")
end

// 2. Iteration (for in collection)
for item in ["Silicon", "Bytecode", "Intent"]
    print("Processing:", item)
end

// 3. Loops (while condition)
let i = 0
while i < 5
    print("Step:", i)
    i = i + 1
end

04.Actions (Functions) & Execution

Functions in AAYU are declared with the action keyword and invoked with standard call notation. Top-level program entrypoints are triggered with run <action>.

actions.aayu
action calculate_tax(amount, rate)
    let tax = amount * rate
    return tax
end

action main
    let total = calculate_tax(100.0, 0.18)
    print("Total Tax:", total) # 18.0
end

run main

05. Standard Libraries (std/)

AAYU includes built-in standard modules written in pure AAYU. No external package manager or pip/npm downloads are required.

std/collections.aayu

21 functional helpers: sum, min, max, mean, contains, index_of, slice, concat, reverse, range, fill, flatten, unique, zip, take, drop.

import "std/collections"

let vals = [10, 20, 30]
print("Sum:", sum(vals))       # 60
print("Mean:", mean(vals))     # 20
let r = range(1, 5, 1)         # [1, 2, 3, 4]

std/fs.aayu & std/os.aayu

Native file system and operating system query functions.

import "std/fs"
import "std/os"

write_file("data.log", "OK")
let text = read_file("data.log")
print("OS:", os_platform())

06.Native AI Agent Protocol (MCP) & Healer

AAYU includes an embedded Model Context Protocol (MCP) server conforming to the 2024-11-05 spec. AI coding agents (Claude Code, Cursor, Windsurf, Antigravity) connect directly via stdio JSON-RPC without shell friction.

Terminal & JSON-RPC 2.0
# 1. Start native MCP stdio server for AI agents
aayu mcp

# 2. Run instant 9/9 verification test suite
aayu mcp --verify

# 3. Available In-Memory Silicon Tools:
# • aayu_run            - Direct in-memory execution with microsecond latency metrics
# • aayu_check          - Sub-millisecond syntax & import validation without execution
# • aayu_test           - Native test suite runner (std/test assertions)
# • aayu_disasm         - Silicon bytecode disassembler and opcode inspection
# • aayu_token_density  - AI agent prompt context budgeting & BPE token density
# • aayu_repair         - Autonomous code healer (auto-fixes Python/JS syntax leaks)

Read the Full 21-Chapter Handbook

Deep dive into compiler AST trees, bytecode ISA opcodes, SQLite storage engine, and master algorithms in the official 1.8 MB PDF.

Download Handbook PDF