100% Pure Self-Hosted Standard Library (Zero Python, Zero C)

AAYU Standard Libraries (All 16 Production Modules)

Production-ready, deterministic standard libraries running natively on the AAYU Silicon Stack VM. Every module is importable with standard import "std/<name>" syntax.

std/collectionsData Structures & Algorithms

Dynamic arrays, selection sort, string tokenization, functional predicates, and zero-boilerplate number parsing.

Key Exported Actions
sorted(arr)split(str, delim)strip(str)replace(str, a, b)lower(str)upper(str)parse_ints(arr)sum(arr)mean(arr)enumerate(arr)any(arr)all(arr)zip(a, b)contains(arr, val)
Example Usage
import "std/collections"
let s = sorted([50, 10, 40])
let money = parse_ints(split("10 20 30", " "))
print("Total: " + sum(money))
std/mathMathematics & Neural Activations

Hardware-level arithmetic, square roots via Newton-Raphson approximation, power exponentiation, and neural activations.

Key Exported Actions
sqrt(x)abs(x)pow(base, exp)max(a, b)min(a, b)clamp(val, low, high)relu(x)sigmoid(x)
Example Usage
import "std/math"
let root = sqrt(49.0)
let bound = clamp(root * 2.5, 0.0, 10.0)
print("Bounded root: " + bound)
std/brainAAYU BrainOS AI Guard

Autonomous AI coding guard, anti-hallucination syntax checking, context handoff snapshotting, and architectural freeze protection.

Key Exported Actions
brain_anti_hallucinate(code)brain_context_handoff(snapshot)brain_security_guard(code)brain_is_frozen(module)brain_ai_guidance()
Example Usage
import "std/brain"
let check = brain_is_frozen("Lexer")
let report = brain_security_guard(apiKeySnippet)
print("Is Frozen: " + check)
std/osOperating System Primitives

Native host platform discovery, CPU architecture querying, process signals, and type inspection.

Key Exported Actions
get_os()get_architecture()get_env_var(name)get_type(value)
Example Usage
import "std/os"
print("Platform: " + get_os())
print("Architecture: " + get_architecture())
std/fsFile System & Paths

File reading and writing, path manipulation, extension parsing, and existence checking.

Key Exported Actions
read_text(path)write_text(path, content)file_exists(path)format_path(dir, file)get_extension(path)
Example Usage
import "std/fs"
let p = format_path("data", "app.ay")
let ext = get_extension("archive.tar.gz")
print("Path: " + p + " (" + ext + ")")
std/cryptoCryptographic Hashing & Merkle Trees

Pure AAYU dual-polynomial polynomial cryptographic hashing, accumulator digests, and Merkle tree root computations.

Key Exported Actions
hash_string(data)merkle_root(leaf_hashes)get_char_byte(ch)
Example Usage
import "std/crypto"
let digest = hash_string("INTENT-TO-SILICON")
print("SHA-equivalent Digest: " + digest)
std/jsonSerialization Engine

RFC 8259 compliant JSON stringify, quotation escaping, and key-value pair formatting without external packages.

Key Exported Actions
json_quote(s)json_format_pair(k, v)json_format_object(pairs)json_format_array(items)
Example Usage
import "std/json"
let pair = json_format_pair("version", json_quote("1.2.0"))
print(pair)
std/dbEmbedded Record Store

In-memory relational record store, primary key lookups, and dynamic multi-attribute query filtering.

Key Exported Actions
db_create_record(id, name, val)db_filter_records(recs, field, val)db_find_by_id(recs, id)db_count_records(recs)
Example Usage
import "std/db"
let r1 = db_create_record(1, "Post", 100)
let found = db_find_by_id([r1], 1)
print("Found: " + found["name"])
std/aiMachine Learning & Tensors

Vector arithmetic, matrix-vector multiplication, multi-layer perceptron (MLP) forward passes, and anomaly scoring.

Key Exported Actions
vec_add(v1, v2)mat_vec_mul(matrix, vec)mlp_forward_pass(features)detect_anomaly(score, threshold)
Example Usage
import "std/ai"
let res = vec_add([1.0, 2.0], [10.0, 20.0])
print("Result: [" + res[0] + ", " + res[1] + "]")
std/uiDeclarative Reactive UI

Widget-tree primitives (Column, Row, Text, Button, Card) rendering directly into clean zero-dependency HTML/CSS.

Key Exported Actions
create_text(content)create_button(label, action)create_column(children)create_row(children)render(tree)
Example Usage
import "std/ui"
let tree = create_column([create_text("AAYU"), create_button("Run", "start")])
let html = render(tree)
print(html)
std/ledgerConsensus & Audit Log

Immutable transaction state transitions, UTXO balance verification, and invariant rule assertion.

Key Exported Actions
verify_balance(bal, amt, fee)apply_transfer(from, to, amt)verify_chain_link(prev, cur)verify_intent_invariant(...)
Example Usage
import "std/ledger"
let ok = verify_balance(500, 100, 5)
let next = apply_transfer(500, 200, 100)
print("Sender Bal: " + next[0])
std/ayonAAYU Object Notation Wire Protocol

Human-readable, comment-aware serialization protocol with automatic comment stripping and dictionary bridging.

Key Exported Actions
ayon_strip_comments(src)ayon_is_space(c)
Example Usage
import "std/ayon"
let clean = ayon_strip_comments("# Note\nkey: \"value\"")
print(clean)
std/httpHTTP Client & Request Protocol

HTTP protocol parsing, URL scheme extraction, standard status code validators, and wire payload formatting.

Key Exported Actions
parse_url_protocol(url)format_request(method, path, host, body)status_is_ok(status_code)
Example Usage
import "std/http"
let proto = parse_url_protocol("https://aayu.dev")
print("Protocol: " + proto + " | OK: " + status_is_ok(200))
std/serverASGI Web Server & Response Builders

HTTP response builders, MIME content-type headers, and JSON/HTML response formatters.

Key Exported Actions
format_response(status, type, body)json_response(status, data)html_response(status, html)
Example Usage
import "std/server"
let resp = json_response(200, "{\"status\":\"ready\"}")
print(resp)
std/testNative Unit Testing & Assertions

Zero-dependency assertion engine, test suite coordinator, and test runner with granular value and type-coerced validation.

Key Exported Actions
assert_eq(actual, exp, name)assert_neq(actual, unexp, name)assert_true(cond, name)assert_false(cond, name)assert_gt(a, b, name)assert_lt(a, b, name)test_begin_suite(name)test_end_suite()
Example Usage
import "std/test"
test_begin_suite("Math Suite")
assert_eq(sqrt(81.0), 9.0, "Root check")
test_end_suite()
std/contractsIntent-to-Silicon Contracts

Design-by-Contract verification primitives for mission-critical intent enforcement, type checking, and system invariants.

Key Exported Actions
require(cond, name)ensure(cond, name)invariant(cond, name)check_type(val, exp_type, param)
Example Usage
import "std/contracts"
action withdraw(bal, amt)
  require(amt > 0, "positive amount")
  return bal - amt
end

Deterministic Execution on Native Silicon

All 14 standard libraries compile directly to compact bytecode and execute on the Rust Silicon Stack VM with zero external runtime dependencies.