Systems scripting language / v0.7.0

A modern systems scripting language.
Strict, expressive, fast as silicon.

Built from first principles with zero external dependencies. A dual-engine runtime with a stack bytecode VM, Cranelift JIT compilation, direct LLVM 18 SSA generation, zero-copy memory buffers, and a fault-tolerant actor mesh.

shae // universal-installer
POSIX & Windows
$ curl -fsSL https://shae-site.vercel.app/install.sh | bash
01 / Capabilities

Systems capabilities in modern syntax

Explore Shae's native features across JIT compilation, actor hot-reloading, zero-copy buffers, encrypted clusters, and coroutines.

typed_service.shae Opt-in gradual static typing with syntax annotations, nullable unions, and compile-time diagnostics via shae check.
// Gradual Type System: syntax annotations with nullable unions
fn calculate_tax(subtotal: float, rate: float | null) -> float {
    let effective_rate: float = rate ?? 0.08
    return subtotal * effective_rate
}

fn fetch_user_id(username: string) -> int | null {
    if username == "admin" { return 1 }
    return null
}

// Static analysis catches type violations before execution:
// $ shae check typed_service.shae
// [OK] All 2 typed function signatures and return bounds verified.

let tax: float = calculate_tax(149.99, 0.05)
print("Computed tax: {tax}")
retro_arcade.shae Unified creative suite with ANSI TrueColor graphics, waveform audio synthesis, and immediate arcade widgets.
use { init, clear, draw_sprite, render, is_key_down } from "std:gui"
use { play_sound, play_tone } from "std:audio"
use { draw_hud, draw_score } from "std:ui"

// Initialize ANSI TrueColor retro display (60x30 virtual matrix)
let screen = init(60, 30, "Space Invaders 2D")
let player_x = 28
let score = 420

// Game loop with 60 FPS frame timing
fn update() {
    clear(screen, 0x000000)
    if is_key_down("Left")  { player_x = player_x - 1 }
    if is_key_down("Right") { player_x = player_x + 1 }
    if is_key_down("Space") {
        play_sound("shoot") // Real-time square-wave synth
    }

    draw_hud(screen, score, 3, 1)
    draw_sprite(screen, player_x, 26, "player_cannon", 0x33FF33)
    render(screen)
}
fibonacci_jit.shae Cranelift JIT SSA compiler detects hot execution loops at invocation threshold and generates native machine code on the fly.
// Cranelift JIT SSA: Compiles hot loops into native machine code
fn fibonacci(n) {
    if n <= 1 { return n }
    return fibonacci(n - 1) + fibonacci(n - 2)
}

// Warm up invocation threshold (JIT_THRESHOLD = 20)
// Cranelift SSA tier kicks in, executing directly as silicon machine code
let result = fibonacci(35)
print("Computed fib(35) in native SSA tier: {result}")

// Direct LLVM 18 SSA IR emission is also built-in:
// $ shae llvm fibonacci_jit.shae -c -o fib_native
// $ ./fib_native  # Standalone zero-dependency executable
vault_daemon.shae Lightweight actor threads with unbounded FIFO mailboxes and zero-downtime hot-code swapping without dropping state or messages.
use { spawn_actor, ask } from "std:actor"

// V1 Actor: Processing banking transactions with persistent state
fn vault_v1(state, msg) {
    match msg {
        { type: "deposit", amount } => state + amount,
        { type: "balance" } => { print("Current vault balance: ${state}"); state },
        _ => state
    }
}

let vault = spawn_actor(vault_v1, 1000)
vault.send({ type: "deposit", amount: 500 })

// Chunk 30: Hot-reload active handler while daemon is running!
// Preserves thread execution, active state, and pending FIFO queue
vault.reload(fn(state, msg) {
    match msg {
        { type: "audit" } => { print("AUDIT: Vault holds ${state}"); state },
        _ => vault_v1(state, msg)
    }
})

let audited = vault.ask({ type: "audit" })
packet_codec.shae Typed memory buffers sharing Arc storage without heap copying, with endian binary I/O and C-struct packing.
use { ByteBuffer, pack, unpack } from "std:buffer"

// Allocate raw contiguous memory buffer
let raw = ByteBuffer.new(1024)

// Binary struct packing: 32-bit uint, two 16-bit ints, 4-char magic
let packet = pack("<I2h4s", 0xDEADBEEF, 128, -42, "SHAE")

// Zero-copy slice: creates a view sharing Arc<RwLock<Vec<u8>>> storage
let header_slice = packet.slice(0, 4)
let magic = header_slice.read_u32_le(0)

print("Decoded magic header: 0x{magic:X}") // 0xDEADBEEF
print("Backing memory refcount: 2 (zero heap allocations)")
cluster_mesh.shae Encrypted distributed actor clustering over Rustls 0.23 with mutual TLS (mTLS), cookie handshake, and bully leader election.
use { ClusterNode } from "std:actor:cluster"

// Initialize encrypted TLS node in cluster mesh
let node = ClusterNode.new({
    name: "worker_alpha",
    bind: "0.0.0.0:9001",
    tls_cert: "certs/node.crt",
    tls_key: "certs/node.key",
    cluster_secret: env("CLUSTER_SECRET")
})

// Peer mutual authentication over encrypted TCP framing
node.connect("worker_beta@10.0.0.2:9001")

// Remote actor dispatch across network with length-delimited framing
let remote_worker = node.actor("pricing_worker@worker_beta")
let quote = await remote_worker.ask({ symbol: "EURUSD", volume: 100000 })

print("Received encrypted cluster quote: {quote.price}")
async_pipeline.shae First-class asynchronous tasks with cooperative scheduling, combinators, and functional Elixir-style pipe operators.
use { spawn, all, sleep } from "std:async"

// First-class coroutines with cooperative task scheduling
let task1 = spawn(fn() { sleep(40); return [12, 45, 88, 92, 105] })
let task2 = spawn(fn() { sleep(60); return [33, 76, 42, 19, 1337] })

// Await multiple asynchronous tasks in parallel
let [batch1, batch2] = await all([task1, task2])

// Elixir-style functional pipelines with zero callback boilerplate
let top_scores = batch1.concat(batch2)
    |> filter(fn(score) { score >= 50 })
    |> map(fn(score) { score * 1.05 })
    |> sort()
    |> reverse()

print("Top normalized scores: {top_scores}")
02 / Telemetry

Architectural metrics & performance telemetry

Measured with shae bench on release builds. Zero startup overhead, minimal memory consumption, and wire-speed throughput.

01
3 ms
Cold Startup
11.6x faster than Python 3.12, 21.6x faster than Node.js
02
4.2 MB
Base Memory
Stack VM with mark-and-sweep GC root tracing
03
138k
Slices / Sec
Zero-copy Arc buffer slicing throughput (Chunk 29)
04
20.8k
Messages / Sec
Multi-threaded actor mailbox throughput (Chunk 14)
05
14 Modules
Self-Hosting
Pure-Shae compiler suite emitting ELF, PE, Wasm & LLVM
06
LLVM 18
Native Backend
Direct SSA IR generation with Clang -O2 standalone binaries
03 / Position

Why Shae?

Modern systems engineering has accumulated friction. Shae is engineered to restore balance between expressive ergonomics and machine reality.

01

Python

GIL & Startup Latency

Clean syntax, but real threads are constrained by the Global Interpreter Lock, cold startup averages 35ms, and dependency resolution often breaks across environments.

The Shae advantage

Shae boots in 3ms with genuine OS threads and lightweight actors, zero venv requirements, and single-binary packaging.

02

JavaScript

Tooling & Memory Bloat

Runs everywhere, but single-threaded event loop blocking degrades CPU tasks, type coercion produces subtle bugs, and small projects require hundreds of megabytes in dependencies.

The Shae advantage

Zero external node_modules needed. Web servers, cryptographic ciphers, SQLite, and regex engines are natively compiled into the runtime.

03

Rust

Borrow Friction in Scripts

Unbeatable performance and memory safety, but writing rapid pipelines, dynamic configurations, or prototypes requires wrestling with lifetimes and complex traits.

The Shae advantage

Instant iteration without lifetime friction. When maximum raw performance is required, direct LLVM SSA compilation produces standalone binaries.

04

Go

Repetitive Error Boilerplate

Clean concurrent channels, but codebases suffer from repetitive error-handling boilerplate, lack pattern matching with guards, and offer no functional pipe transformations.

The Shae advantage

Expressive pattern matching with guards, structured try/catch exception frames with preserved stacks, and first-class functional pipelines (|).

Chunks 1–34 verified

Explore the complete engineering pipeline

From the Pratt parser and AST evaluator to the Cranelift JIT, zero-copy std:buffer, Rustls TLS cluster mesh, and pure-Shae self-hosting compiler suite.