Veko 1.0 — Master End-User, Standard Library, Systems & Operations Handbook
Part I: Veko 1.0 — Overview & Quickstart
Veko (.vk source, fixed-width 64-bit .vko portable bytecode, .wasm WebAssembly 3.0 modules, and standalone native executables across 5 zero-dependency OS/CPU targets: win-x64 PE32+, win-arm64 PE32+ 0xAA64, linux-x64 ELF64, linux-arm64 ELF64, and macos-arm64 Mach-O) is a 100% self-hosted homoiconic systems and dialect programming language (https://veko-lang.org) designed to read like clear human commands, reclaim memory deterministically without a garbage collector, and execute across three backends built in pure .vk (src/, 46 modules) paired with an embedded 95-module pure-.vk standard library (lib/).

Why Veko Exists
Most programming languages force an uncomfortable trade-off between low-level control (C, C++, Rust, Zig with heavy punctuation or lifetime annotations), everyday ergonomics (Python, Go, Ruby, TypeScript with stop-the-world garbage collection pauses), and syntactic extensibility (Lisp and Forth with parenthesis soup or manual stack shuffling). Veko unifies all three:
- Parentheseless Prefix Words + Infix Math: Call fixed-arity words left-to-right (
os/write-file path data) while keeping natural infix arithmetic ((crc >>> 8) ^ table[i]), tight dot chains (raw.trim.lower), and slices (buf[0..n]). - Deterministic ORO + Copy-on-Write Memory: Every heap value has a single owner (
rc == 1) and frees deterministically at scope exit. Shared snapshots clone lazily only if mutated, and reference cycles are structurally impossible. - Slash Refinements, Zero
nil, and/orRecovery: Veko 1.0 has nonil. Unit actions evaluate to.ok, JSONnullmaps to.null, and missing lookups or I/O failures return catchableerrvalues handled inline via/or [ fallback ]and LIFOdefer. - Homoiconic
[ ... ]Dialects & Capability Security: Code and data share the same block representation (quote,compose,macro,parse-block), whileveko.vkallow-capsand compile-time/runtime.secretfirewalls prevent unauthorized syscalls and credential leaks.
Veko 1.0 Shared Frontend & Three-Track Execution Pipeline
39 compiler modules (src/) and 79 stdlib modules (lib/) feeding 64-bit VKO VM, Wasm 3.0 sandbox, and 4 native OS/CPU targets.
Three Execution Tracks: Purpose & Decision Guide
All three execution tracks share the exact same lexer, Pratt parser, type/capability checker, ORO ownership rules, and 95-module lib/ standard library (embedded directly inside the single-binary veko SDK):
Choosing Between Veko's Three Execution Tracks
Write idiomatic .vk code once and select the runtime envelope matching development speed, isolation, or native deployment.
| Decision Criteria | Track A: --vm / .vko |
Track B: --wasm (vvm) |
Track C: --native (x86_64 & arm64) |
|---|---|---|---|
| Primary Goal | Instant run, live REPL & .vko bundles |
Zero-trust isolation & leak verification | Standalone OS binaries with zero runtime deps |
| Targets | Cross-platform 64-bit VKO VM |
WebAssembly 3.0 + WASI 0.3 (vvm) |
win-x64, win-arm64, linux-x64, linux-arm64, macos-arm64 |
| Sandbox & Quotas | --fuel, --allow-fs, --allow-net, --allow-listen, --allow-private-net |
Full HostSandbox (--fuel, --mem-pages, --check-slabs, FS chroot, SSRF guard) |
Compile-time veko.vk allow-caps + runtime .secret firewall |
| Networking & UI | lib/net/client, lib/web, lib/reactor, lib/tui, offscreen .ui |
WASI sockets/net-poll + lib/web, lib/tui, offscreen .ui (.ffi forbidden) |
Full OS sockets/DNS/TLS 1.3, epoll/kqueue/IOCP, live Win32 --gui, opt-in .ffi |
Meet Eko — The Veko Mascot

Veko's mascot is Eko, a silver-taupe Galago (bush baby):
- Why a Galago named Eko? Eko plays on echo—the clean reflection of homoiconic
[ ... ]blocks and compile-time dialects that turn domain notation directly into native code—paired with V to form Veko. - Oversized Amber Eyes & Inspectability: A bush baby sees clearly in the dark without guesswork, mirroring Veko's explicit
mutloans and built-in token, AST, module, and bytecode inspectors (veko inspect). - Independent Acoustic Ears & Refinements: Galagos swivel each ribbed ear to isolate exact signals; Veko's slash refinements (
/timeout,/secret,/or) andparse-blockrules compose behavior cleanly at the call site. - Nimble Single-Branch Balance (
ORO + CoW): Agile and lightweight, a Galago lands cleanly on one branch at a time—just as One Reference Only keeps a single owner per value and reclaims memory deterministically without GC pauses.
End-User Documentation Reading Path
| Order & Guide | Audience | What You Will Learn |
|---|---|---|
| 01. Overview & Quickstart (this page) | Everyone | Core pillars, execution tracks, and first commands |
| 02. Full Tutorial | New Learners | 9 hands-on lessons from REPL & pipes through macros, spawn, and structs |
| 03. Language Guide | Developers | Complete guide to syntax, whitespace rules, ORO memory, closures, and dialects |
| 04. How-To & Newcomer Guide | Newcomers & Devs | 5 pointers on how to read/write Veko, token/AST inspection, and project recipes |
| 04b. Cookbook & Language Comparisons | Evaluators & Devs | Idiomatic recipes plus Readability & Writability vs. Go, Rust, Zig, Elixir/Rebol, and Python/TS |
| 05. Developer Tooling | All Engineers | veko debug & VS Code F5 DAP, veko test --coverage, testing/fuzz, veko fmt, veko lsp, veko doc --html, SVG flamegraphs, veko-lang.org packages, and migrators |
| 06. Standard Library & PQC | App & Crypto Devs | Complete 95-module stdlib index, collections, codecs, classical crypto, and NIST FIPS 203/204/205 PQC |
| 07. Net, Web, DB & VKP1 | Backend & Web Devs | io/Stream, DNS, Hybrid PQC TLS 1.3, HTTP/2, QUIC HTTP/3, WebSockets, web + html, JWT/OAuth2/TOTP, Zero-FFI SQLite 3 & ORM (db/sqlite), db/*, and veko-lang.org VKP1 packages |
| 08. Async I/O & Reactor | Systems Devs | epoll/kqueue/IOCP readiness reactor, timers, cross-thread wakers, web/serve-reactor, and batch HTTP |
| 09. Durable Objects & Workflows | Distributed Devs | Crash-safe Durable Objects and replay-safe Durable Workflows with LIFO sagas over db/kv |
| 10. TUI, Native UI & FFI | Desktop & C/Rust Devs | Diffing ANSI tui, 29-widget RGBA32 desktop UI, Win32 + Linux Wayland/X11 + macOS arm64 Cocoa + Wasm <canvas>, clipboard/Hi-DPI, and .ffi (VEKO_LIB) |
| 11. Perf, SIMD & ARM64 | Systems Engineers | Zero-JIT philosophy, AVX2/SSE2/AES-NI, cached veko run --native, and win-arm64/linux-arm64/macos-arm64 |
| 12. Examples & Showcase Apps | All Engineers | Walkthrough of all 45 examples (01..40 + core tours) and 6 multi-module demos/ apps |
| 13. Administrator Guide | Operators & SecOps | Build governance, allow-caps, vvm HostSandbox quotas, VKP1 trust-keys, and .secret wiping |
| 14. CLI & Syntax Reference | All Users | Complete CLI subcommands & flags, veko.vk schema, Pratt precedence ladder, and 105+ builtin arities |
| 15. Master User Handbook | All Users | Consolidated single-page edition of all End-User guides |
Zero-Install Playground & One-Line SDK Installation
Try Veko instantly in your browser (client-side WebAssembly 3.0 Web Worker + <canvas> + sandboxed 64-bit VKO VM) at https://veko-lang.org/play, or install the single-binary portable SDK on Linux, macOS Apple Silicon, or Windows (x86_64 and native Windows 11 ARM64 — Snapdragon X Elite/Plus, Surface Pro/Laptop, and Windows on ARM VMs):
# Linux (x86_64 / arm64) and macOS (Apple Silicon arm64) — SHA-256 verified
curl -fsSL https://veko-lang.org/install.sh | sh
# Windows (PowerShell — auto-detects x64 vs. ARM64 and installs veko-1.0.0-win-x64.zip or veko-1.0.0-win-arm64.zip)
irm https://veko-lang.org/install.ps1 | iex
Offline .zip SDK archives (veko-1.0.0-win-x64.zip for Windows x86_64 PE32+ and veko-1.0.0-win-arm64.zip for native Windows 11 ARM64 PE32+ 0xAA64, bundling veko.exe, lib/, examples/, AGENTS.md, README.md, and LICENSE) are also available at https://veko-lang.org/download.
Quickstart Commands
# Verify all 18 test suites or run the full S1 == S2 build orchestrator
veko run tests/run_tests.vk
veko run build.vk -- all
# Run programs across ORO VM (--vm), Wasm 3.0 (--wasm), or cached Native (--native)
veko run examples/hello.vk
veko run --wasm --check-slabs examples/09_concurrent_worker_pool.vk
veko run --native examples/29_async_reactor_http_server_and_client.vk
veko run --native examples/32_durable_objects_and_workflows.vk
# Cross-compile standalone native binaries for all 5 zero-dependency OS/CPU targets
veko compile --native --target=win-x64 examples/14_http_json_api_server.vk -o dist/api.exe
veko compile --native --target=win-arm64 examples/hello.vk -o dist/hello_win_arm64.exe
veko compile --native --target=linux-x64 examples/hello.vk -o dist/hello_linux_x64
veko compile --native --target=linux-arm64 examples/hello.vk -o dist/hello_linux_arm64
veko compile --native --target=macos-arm64 examples/hello.vk -o dist/hello_macos_arm64
# Run multi-module showcase applications (Web, Desktop GUI, Multi-Protocol Mesh, PQC Vault)
veko run --native demos/taskflow_studio/src/main.vk
veko run --native demos/canvas_workbench/src/main.vk
veko run --native demos/pulse_mesh/src/main.vk
veko run --native demos/vault_dialect/src/main.vk
# Launch the interactive REPL or regenerate HTML documentation
veko repl
veko docs
Part II: Full Veko Language Tutorial
This hands-on tutorial walks through everything you can write and run in Veko today using veko check, veko run, veko compile, veko repl, and veko inspect.
Lesson 1: Running Programs, Inspecting Code, and the REPL
Whitespace Disambiguation & Two-Pass Pratt Homoiconic Engine
How [tight] vs [spaced] tokens let kebab-case prefix calls coexist cleanly with infix math, UFCS chains, and macros.
Start by running an existing example or opening the interactive ORO REPL:
# Run a Veko script on the ORO bytecode VM
veko run examples/01_basics_and_math.vk
# Inspect lexer tokens, Pratt AST, or compiled 64-bit VKO bytecode
veko inspect --tokens examples/01_basics_and_math.vk
veko inspect --ast examples/01_basics_and_math.vk
veko inspect --bytecode examples/hello.vk
# Start the interactive REPL
veko repl
Inside veko repl, bindings persist across lines, multi-line [ ... ] and { ... } blocks balance automatically, and built-in REPL commands let you watch ORO memory live:
:statsprintslive_slabs,globals, and compiledfnscount.:resetclears all globals and slabs back to a clean VM.:quitexits the REPL.
Lesson 2: Bindings, Rich Literals, Math, and Slicing
Veko keeps everyday code on unshifted keys: = binds values, '...' defines UTF-8 strings, .word creates enum symbols, and durations/sizes are native literals (1024-based for byte sizes):
// examples/01_basics_and_math.vk
title = 'Veko Basics'
timeout = 250ms
buf-cap = 4kb
proto = .tcp
// Spaced infix arithmetic & bitwise ring-buffer indexing
head = 12
offset = 7
cap = 16
next-slot = (head + offset) & (cap - 1) // 3
// Ranges & tight slicing
nums = 1..=5 // [1 2 3 4 5]
sub = nums[1..4] // [2 3 4]
// Mutable loop state
mut i = 0
mut sum = 0
while i < 5 [
i = i + 1
sum = sum + i
]
println sum // 15
unless zero? sum [
println 'sum-nonzero'
]
Important Spacing Rule: Always put spaces around binary - and / (cap - 1, total / count) so the lexer does not treat them as kebab-case words (read-into) or module paths (str/trim).
Lesson 3: Pipes, UFCS Dot-Chains, JSON, and match
Because every word has a fixed compile-time arity, pipelines flow cleanly from left to right without nested parentheses. Use \ pipes to pass a value as the first argument to the next multi-argument word, and tight . chains for field access or 1-argument transforms:
// examples/02_pipelines_and_json.vk
use [j = json, s = strings]
payload = '[{"name": " alpha ", "score": 90, "active": true}, {"name": " beta ", "score": 40, "active": false}, {"name": " gamma ", "score": 85, "active": true}]'
names = payload
\ j/decode
\ filter fn [item] [item.active]
\ map fn [item] [item.name.trim.upper]
println (s/join names ' | ') // ALPHA | GAMMA
scores = payload
\ j/decode
\ filter fn [item] [item.active]
\ map fn [item] [item.score]
total = reduce scores 0 fn [acc x] [acc + x]
println total // 175.0
ev = { kind = .ready, code = 200 }
status-msg = match ev.kind [
.starting ['booting']
.ready ['serving']
_ ['unknown']
]
println status-msg // serving
Lesson 4: ORO Buffers, Secrets, defer, /or, and recur
Veko gives you deterministic zero-GC memory through One Reference Only (ORO) rules:
bytes/with-capallocates a reusable byte slab once;mutloans mutate it in place with zero reallocations.bytes/with-secretmarks a slab withflag_secretso its contents are overwritten with zero bytes the moment its scope exits.defer [ ... ]runs cleanup blocks in LIFO order when the enclosing function returns./or [ ... ]catches errors inline on any fallible call (str/index-of/or,os/read-file/or,net/http/fetch/or; note that pure-.vkcodec/http1+net/*works identically across all three tracks including--native).recurperforms constant-stack tail recursion back to the top of the currentfn.
// examples/03_oro_buffers_and_errors.vk
use [bytes, ascii, str]
pkt = bytes/with-cap 4kb
bytes/push-all mut pkt (bytes/from-str ' ping trustnode ')
ascii/trim-right! mut pkt
ascii/upper! mut pkt
bytes/push mut pkt 33
println (str/from-bytes pkt) // PING TRUSTNODE!
use-secret = fn [label] [
secret = bytes/with-secret 64b
bytes/push-all mut secret (bytes/from-str 'ephemeral-session-key')
println (str/append label ':secret-ready')
secret.len
]
println (use-secret 'auth') // 21 (and secret slab zeroed on return)
safe-find = fn [hay needle] [
defer [println 'cleanup-done']
str/index-of/or hay needle [-1]
]
println (safe-find 'veko-oro-vm' 'oro') // 5, then cleanup-done
println (safe-find 'veko-oro-vm' 'missing') // -1, then cleanup-done
gcd = fn [a b] [
if zero? b [return a]
recur b (a % b)
]
println (gcd 84 36) // 12
Lesson 5: Homoiconicity, compose, parse-block, and Macros
Code inside [ ... ] is a live homoiconic list of words, numbers, enums, durations, strings, and nested blocks:
// examples/04_macros_and_dialects.vk
spec = quote [route .tcp '10.0.0.0/8' 8443 30s]
println spec.len // 5
println (type-of spec[1]) // .enum_sym
println spec[4] // 30s
port = 9000
tls-mode = .strict
server-cfg = compose/deep [
bind '127.0.0.1' (port)
policy [mode (tls-mode) timeout 15s]
]
println (mold server-cfg) // [bind '127.0.0.1' 9000 policy [mode .strict timeout 15s]]
mut endpoints = []
parsed-ok = parse-block (quote [allow .tcp '10.1.0.0/16' 443 allow .udp '10.2.0.0/16' 51820]) [
any [
['allow' proto = enum! cidr = str! p = int!] [
push mut endpoints (compose [(proto) (cidr) (p)])
]
]
]
println parsed-ok // true
println (mold endpoints) // [[.tcp '10.1.0.0/16' 443] [.udp '10.2.0.0/16' 51820]]
triple = macro [x] [
compose [(x) + (x) + (x)]
]
println (triple 14) // 42
Lesson 6: Stateful Closures & Capability Records (No OOP Needed)
Closures capture outer variables into their own private ORO slab—making stateful generators cycle-free and giving you clean runtime polymorphism via explicit records of closures:
// examples/05_closures_and_capabilities.vk
use [str]
make-seq = fn [start] [
mut cur = start
fn [step] [
out = cur
cur = cur + step
out
]
]
next-port = make-seq 8000
println (next-port 10) // 8000
println (next-port 10) // 8010
println (next-port 10) // 8020
make-logger = fn [prefix] [
{
info = fn [msg] [println (str/append prefix msg)]
warn = fn [msg] [println (str/append '[WARN] ' msg)]
flush = fn [] [println (str/append prefix 'flushed')]
}
]
app-log = make-logger '[veko] '
log-info = app-log.info
log-warn = app-log.warn
(log-info 'initialized') // [veko] initialized
(log-warn 'cache-miss') // [WARN] cache-miss
call app-log.flush // [veko] flushed
Lesson 7: Multi-File Projects, pub/export, and veko.vk Manifests
As programs grow, split reusable helpers across logical modules without OS paths or circular imports. Everything in a module stays private by default; export only functions or compile-time macros using pub or export [...]:
// src/lib/codec.vk
salt = 7
mask = fn [x] [x ^ salt] // private helper (cannot be called externally)
pub encode = fn [x] [mask (x * 3)]
wrap-add = macro [a b] [compose [(a) + (b)]]
export [wrap-add]
Add an optional homoiconic veko.vk manifest in your project folder to declare the source root, external dependencies, and least-privilege capability limits:
// veko.vk
{
name = 'edge-app'
root = 'src'
allow-caps = [.fs]
}
Then import modules by logical name in your entry file, audit capabilities, and run identically on ORO VM, .vko, WebAssembly 3.0, or standalone native x86_64 & AArch64:
// src/main.vk
use [c = lib/codec]
println (c/encode 4) // 11
println (c/wrap-add 20 22) // 42
println (4 \ c/encode) // 11
# Audit module DAG, exported arities, and effective capabilities
veko inspect --modules src/main.vk
# Run identically across ORO VM, compiled .vko bytecode, Wasm 3.0, or native x86_64 & arm64
veko run src/main.vk
veko compile --vko src/main.vk -o dist/app.vko
veko run dist/app.vko
veko run --wasm src/main.vk
veko run --native src/main.vk
veko compile --native src/main.vk -o dist/app.exe
./dist/app.exe
# Or cross-compile standalone Windows ARM64, Linux x86_64, Linux ARM64, or macOS Apple Silicon binaries
veko compile --native --target=win-arm64 src/main.vk -o dist/app_win_arm64.exe
veko compile --native --target=linux-x64 src/main.vk -o dist/app_lx64
veko compile --native --target=linux-arm64 src/main.vk -o dist/app_arm64
veko compile --native --target=macos-arm64 src/main.vk -o dist/app_macos
Lesson 8: Shared-Nothing Concurrency & Guarded Networking
Veko pairs isolated spawn [ ... ] workers with bounded ownership-transfer channels (chan/*) and guarded networking across host OS sockets (--vm), wasi:sockets@0.3.0 / wasi:http@0.3.0 (--wasm), and native WinSock2 / Linux / macOS sockets (--native)—blocking mutable aliasing, data races, .secret network leaks, and SSRF by construction:
ch = chan/new 4
worker = spawn [
chan/send ch 'ready-from-worker'
42
]
msg = chan/recv ch
res = task/await worker
chan/close ch
println msg // ready-from-worker
println res // 42
When running network clients or local servers, grant least-privilege flags explicitly (--allow-net, --allow-listen, --allow-private-net) on veko run (applies to both --vm and --wasm), and declare allow-caps = [.net] inside veko.vk. Standalone --native binaries execute directly as OS processes with .secret egress blocks still enforced at runtime.
Lesson 9: Typed Structs, veko check, Checked Conversions & Secrets
Opt into static types incrementally with struct { ... }, interface { ... }, parameter/return annotations, secret field qualifiers, and checked numeric/string conversions—preserving clean /or fallbacks and cross-backend speed:
Upstream = struct {
name str
host str
port i64 = 443
api_key secret str = ''
}
score-samples = fn [ep Upstream, factor u8, n i64] i64 [
mut acc = 0
mut i = 0
while i < n [
acc = acc + factor + i
i = i + 1
]
acc + ep.port
]
parsed-port = str/to-i64/or '8443' [443]
weight = as-u8/or 12 [as-u8 0]
tok = os/getenv/secret/or 'API_KEY' ['local-dev-key']
u1 = Upstream { name = 'edge-us', host = 'api.veko.local', api_key = tok }
u2 = u1 \ struct/with { port = parsed-port }
println (score-samples u2 weight 5000)
# Static type + secret taint verification across modules
veko check examples/12_typed_structs_and_secrets.vk
veko check --strict-types examples/12_typed_structs_and_secrets.vk
# Execute identically on ORO VM, Wasm 3.0 (unboxed math loops), or native x86_64 / arm64
veko run examples/12_typed_structs_and_secrets.vk
veko run --wasm examples/12_typed_structs_and_secrets.vk
veko run --native examples/12_typed_structs_and_secrets.vk
veko compile --native examples/12_typed_structs_and_secrets.vk -o dist/12.exe
./dist/12.exe
veko compile --native --target=linux-x64 examples/12_typed_structs_and_secrets.vk -o dist/12
veko compile --native --target=linux-arm64 examples/12_typed_structs_and_secrets.vk -o dist/12_arm64
Next Steps
Continue along the End-User reading path:
- Master ownership, closures, and dialects in the Language Guide.
- Explore the 93-module standard library, zero-FFI SQLite 3 & ORM (
db/sqlite), and NIST Post-Quantum Cryptography in the Standard Library & PQC Guide. - Build non-blocking servers, durable workflows, and desktop/web apps with Async I/O & Reactor, Durable Objects & Workflows, TUI, Native UI & FFI, and Examples & Showcase Apps.
Part III: End-User Language Guide
This guide introduces Veko's syntax, memory model, closures, homoiconicity, non-OOP composition patterns, and three execution backends.
1. Words, Refinements, and Pipelines
Veko eliminates outer parentheses and commas for normal function calls. Because every word has a fixed compile-time arity, expressions read cleanly from left to right:
// Bindings use '=', strings use single quotes, durations and sizes are native literals
timeout = 5s
max-buf = 64kb
mode = .tls
print 'starting sync'
Slash Refinements
Optional behavior never relies on positional boolean flags or multi-line option structs. Words expose slash refinements that extend static arity at the call site:
use [h = net/http, j = json, s = strings, os]
// Base call takes 1 argument (url)
body = h/fetch 'https://example.com/peers'
// Adding /timeout extends static arity to 2 (url, duration)
body = h/fetch/timeout 'https://example.com/peers' 3s
// Universal /or handles errors inline without try/catch pyramids
body = h/fetch/timeout/or 'https://example.com/peers' 3s [
log/warn 'using cached peer list'
os/read-file 'peers.cache.json'
]
UFCS Dot-Chains and \ Pipes
- Tight dot-chains (
.) read struct/map fields (peer.endpoint) or chain 1-argument transforms (raw.trim.upper). - Pipes (
\) inject the left-hand result as the first argument of the next multi-argument word:
sync-peers = fn [endpoint out-path] [
active-urls = h/fetch/timeout endpoint 5s
\ j/decode
\ filter fn [p] [p.active]
\ map fn [p] [p.url.trim]
os/write-file out-path (s/join active-urls '\n')
active-urls.len
]
Arithmetic and Tight Indexing
Binary math and bitwise operators work with standard infix precedence when spaced cleanly:
crc = (crc >> 8) ^ table[(crc ^ b) & 0xff]
next-slot = (head + offset) & (cap - 1)
header = packet[0..16]
2. Deterministic Memory Without a Garbage Collector (ORO + CoW)
ORO Single-Owner Memory: Borrow, Move, mut Loan & Copy-on-Write
Rust-grade deterministic cleanup and zero garbage collector pauses without lifetime annotations.
Veko enforces One Reference Only (ORO) backed by Copy-on-Write (CoW):
- Plain Words Borrow for Free: Passing
packettolog/debug packetlends read-only access for the call duration—zero copies and zero reference-count updates. =Moves Ownership: Assigningb = atransfers ownership toband deterministically frees whateverbpreviously held.mutMutates in Place: Functions may modify an argument in place only when both the parameter and call site carrymut:
use [net, bytes, ascii]
echo-session = fn [mut conn] [
defer [net/close/or mut conn []]
// Allocated once; freed deterministically when echo-session returns
mut buf = bytes/with-cap 4kb
forever [
n = net/read-into/or mut conn mut buf [break]
if zero? n [break]
ascii/trim-right! mut buf
ascii/upper! mut buf
bytes/push mut buf 10
net/write/or mut conn buf [break]
]
]
Closures Without Reference Cycles
When a fn captures outer variables, those values move (or CoW-snapshot) into the closure's owned environment block:
make-counter = fn [start] [
fn [step] [
start = start + step
start
]
]
next-id = make-counter 100
print (next-id 1) // 101
print (next-id 5) // 106
Because each closure owns its private environment tree and recursive self-calls use an implicit recur/self word without storing the closure inside its own capture block, reference cycles cannot form.
Higher-Order Functions & Dynamic Closure Calls
Functions in Veko (fn [...] [...]) are first-class values that can be passed to combinators (filter, map, each, reduce), returned from factories, or stored inside capability records:
- Static-arity bindings call directly: Top-level or local
name = fn [a b] [...]bindings have known compile-time arity and call left-to-right without parentheses (name 1 2). - Dynamic closure values use
(callee arg1 ...)or(f)/call: When invoking a function parameter, returned closure, or record callback whose arity is only known at runtime, wrap the call in parentheses ((next-id 1),(transport.read mut buf), or 0-arg(transport.flush)/call f). Note thatspawnblocks reject capturing runtime closures across isolated workers.
"No nil" Discipline, Disjoint Field mut Loans & [T] Generics
Veko 1.0 eliminates nil completely so missing data never silently propagates:
- Missing Lookups & Empty Pops Return
err:map/get m k,m[k],m.k,json/get s k, and emptypop,first, orlastreturn catchableerrvalues handled explicitly with/or(host = map/get/or cfg 'host' ['127.0.0.1']). - Explicit
.ok&.nullEnums: Side-effect actions (print,log/*,time/sleep,net/close,chan/send,os/mkdir), one-armedifexpressions, loops, and 0-argreturnevaluate to.ok, while JSONnullround-trips cleanly via.null(json/decode 'null' == .null). - Struct-Field
mutLoans (mut ctx.field): Mutable struct bindings can lend disjoint fields directly in place (bytes/push mut state.buf 10,put mut state .count (state.count + 1)) while preserving Copy-on-Write snapshots automatically. - Parametric
[T]Generics,sealedStructs &/internal/Modules: Functions and structs support checker-level type parameters (id = fn [T] [x T] T [ x ],pub Box = sealed struct [T] { val T }),sealed structrestricts direct construction andmutfield loans to the defining module, andpkg/internal/*modules are confined to importers underpkg/*.
3. Homoiconicity and Compile-Time Dialects
Everything inside [ ... ] is a live homoiconic block of typed values (words, paths, numbers, durations, sizes, enums, strings, and nested blocks).
quote [ ... ]preserves a block as unevaluated data.compose [ ... ]walks a block and evaluates only expressions wrapped in( ... ), avoiding Lisp backtick/comma punctuation soup.parse-blockmatches structural token patterns (word!,enum!,str!,int!,dur!,block!) inside compile-timemacrodefinitions to lower domain mini-languages directly into static code.
4. Intentional Non-OOP Design
Veko intentionally omits classes, inheritance, and mutable this object graphs because shared mutable identities break ORO determinism and opaque private fields break homoiconicity:
- Closed Variants: Use tagged unions with
match ev.kind [ .ping [...] .data [...] ]. - Open Pluggability: Pass explicit capability records (
Transport { read = fn [mut dst] [...], write = fn [src] [...] }) constructed from ORO closures.
5. Multi-File Modules & Private-by-Default Encapsulation
Veko separates local code organization from public module APIs without ambient filesystem searching or mutable global leaks:
- Logical Module Paths Only: Imports (
use [alias = lib/codec, crypto]) never mention./,../, OS path separators, or.vkextensions. Precedence resolves reserved built-ins (bytes,str,json,os,time,log,net,http), then projectroot, then declareddepsinveko.vk. - Functions, Macros & Structs (
pub/export): All top-level bindings are private by default. Export functions, compile-time macros, and struct schemas (pub encode = fn [...] [...],pub Endpoint = struct { ... }, orexport [fn1 macro2 Endpoint]), while forbidding shared mutable globals across modules. - Single Diamond Initialization: Shared modules initialize once in topological order with isolated global namespaces, preventing cross-module name collisions even when private helper names match.
6. Shared-Nothing Concurrency & Cross-Backend Networking
Veko extends ORO ownership rules across threads cleanly:
- Isolated
spawn [ ... ]Tasks & Bounded Channels: Each spawned task executes inside its own private ORO arena (oro_vm.vk), isolated WasmHostSandbox(codegen.vk), or private OS worker thread state (native_emit.vk/arm64_emit.vk). Capturing or mutating outermutvariables acrossspawn, or sending.secret,mutloans, or closures throughchan/send, is rejected deterministically. - Explicit Network Capabilities:
net/listen-tcp,net/connect-tcp,net/accept,net/read-bytes,net/read-into,net/write,net/write-string,net/resolve, UDP sockets, and the 11net/poll-*/net/try-*readiness reactor primitives—along with pure-.vknet/dns,net/client,web,codec/http1,net/http2,net/websocket, and Hybrid PQCnet/tls13—run across all three backends (oro_vm.vk,codegen.vk, andnative_emit.vk/arm64_emit.vk), while host-bridgedhttp/fetchandhttp/requestrun on--vmand--wasm. Underveko run(--vmand--wasm), networking stays disabled by default until authorized (--allow-net,--allow-listen,--allow-private-net), and all backends block.secretvalues on every network sink and enforce SSRF guards.
7. Gradual & Strict Types, O(1) Structs & Secret Flow Governance
Veko keeps zero-annotation scripting effortless while letting critical paths and shared module boundaries opt into static verification and unboxed execution:
- Typed
structSchemas &struct/with: Define schemas with defaults (Upstream = struct { host str, port i64 = 443, api_key secret str = '' }), verify missing/unknown fields at compile time, read fields directly in O(1), and produce updated snapshots cleanly withprimary \ struct/with { port = 8443 }. - Checked Narrowing & Runtime Guards: Use
str/to-i64,str/to-f64,as-u8,as-i64, andas-f64paired with/orinstead of silent truncation; annotated functions (fn [factor u8, ep Upstream] i64 [...]) enforce runtime entry guards across Veko's execution backends. veko check [--strict-types]: Validate cross-module types,mutborrows, and.secretsink policies statically before running or deploying;os/getenv/secret, redaction to<secret>, and deep.secretblocking onjson/encodeandos/write-fileprovide runtime defense in depth.
Designing Safe & Resilient Systems in Veko
Veko combines four built-in guarantees so everyday scripts and production services stay predictable under invalid input, concurrency, and resource pressure:
- Memory Safe in Everyday
.vkCode: Indexing and slicing onbytes,str,block, andstructvalues are bounds-checked (spatial safety), single-owner ORO + Copy-on-Write (CoW) prevents use-after-free, double-free, and cyclic leaks without GC pauses (temporal safety), andspawnforbids sharing mutable references or closures across threads (data-race freedom). - Explicit Error & Cleanup Paths: Division/modulo by zero (
/ 0,% 0), integer/float parsing (str/to-i64,str/to-f64), and range narrowing (as-u8) raise catchable/orerrors instead of silently truncating or crashing the process. Pair/orwith LIFOdeferso files, sockets, and buffers always clean up cleanly along both normal and error paths. - Schema & Capability Discipline: Enforce required fields and defaults in
structdefinitions, apply immutable snapshots withstruct/with, load credentials viaos/getenv/secret(automatic<secret>redaction, egress blocking, and zero-wipe on free), and declare explicitallow-capsinveko.vkaudited withveko check --strict-typesandveko inspect --modules.
8. Choosing Your Execution Backend
Veko compiles the same .vk source language across three backends—each built for a distinct purpose:
- 64-Bit
VKOBytecode VM (--vm/.vko): Created for instant script execution, the interactiveveko repl, dynamiceval, and precompiled 64-bitVKOdistribution. Ideal for everyday development, doctests, and rapid iteration. - WebAssembly 3.0 Sandbox (
--wasmviavvm): Created for zero-trust, portable sandboxing. Compiles.vkprograms to validated Wasm 3.0 with unboxedi64/f64loops and runs insidevvm'sHostSandboxwith explicit--fuel,--mem-pages,--allow-fs,--allow-hosts, and--check-slabsleak verification. - Native x86_64 & AArch64 (
--nativeviaveko): Created for standalone Windows (--target=win-x64and--target=win-arm640xAA64PE32+, with optional--gui), Linux (--target=linux-x64and--target=linux-arm64static ELF64 via direct syscalls), and macOS Apple Silicon (--target=macos-arm6416 KiB Mach-O + SHA-256LC_CODE_SIGNATURE) executables with zero external C compiler, LLVM, or OpenSSL dependencies. Emits register-allocated native loops, CPUIDAVX2/SSE2/AES-NIbulk operations, 12-bucket ORO slab recycling, OS-native readiness reactors (epoll/kqueue/IOCP), full DNS/TCP/UDP/TLS 1.3 networking (net/dns,net/client,web), and opt-in.ffiC-ABI shared library interop.
Part IV: How-To Guide & Newcomer Mental Model
Step-by-step pointers for reading and writing idiomatic .vk code, inspecting parsed programs, building Veko workspaces, and regenerating documentation.
0. Pointers & Best Practices for Newcomers (How to Read & Write Veko)
1. Shift Your Mental Model from "Punctuation" to "CLI Commands"
Newcomers arriving from Go, Rust, or TypeScript often try to read Veko like C without parentheses and get tripped up. Instead, read each Veko line like a Unix shell command with fixed compile-time arity:
os/write-file out_path payload
- Reading tip: Every word consumes a known number of arguments to its right. Zero-argument functions (such as
host-bin-pathinbuild.vk) run simply by naming them — no()needed. - Parentheses rule of thumb: Never attach
(directly to a function name (len(xs)is wrong). Use(...)only when an argument is itself a multi-token expression:
while i < (len items) [ ... ]
2. Treat Whitespace as Semantic Punctuation
In C-family languages, spaces are mostly optional decoration. In Veko, spaces separate words while tightness glues paths and accessors together:
- Space around
-and/when doing math:n - 1anda / b. Without spaces,n-1is a single kebab-case identifier andstr/joinis a module path. - Keep
.and[...]tight to the target:user.name.trim,buf[0..n]. A leading space turns.okor.tlsinto an enum literal (return .ok). - Space before unary
-:add x -1passes-1;x - 1subtracts1.
3. Flatten Nested Parentheses with \ Pipes and . Chains
The primary readability anti-pattern in prefix languages (such as Lisp) is deeply nested parentheses like (f (g (h x))). Idiomatic Veko stays flat in three ways:
- Bind intermediate steps with short names when performing side effects.
- Use tight
.chains for 1-argument transforms:raw.trim.lower. - Use
\pipes for multi-step data transformations (feeding the left result into argument 1 of the next word):
urls = body
\ json/decode
\ filter fn [p] [p.active]
\ map fn [p] [p.url.trim]
4. Read /refinements and /or as Inline Control Flow
Instead of option structs, overloaded functions, or try/catch blocks, Veko extends words with / refinements and handles errors right at the call site with /or:
port = str/to-i64/or raw_port [ 443 ]
raw = os/read-file/or path [ e -> return (err `cannot read {path}: {mold e}`) ]
- Best practice: Handle or propagate errors immediately with
/or(orif err? x [ return x ]in sequential scripts), and pair resource acquisition withdefer [ ... ]right below it. Never look fornilornull— unit actions return.ok, wire JSONnullis.null, and missing lookups returnerr.
5. Follow the mut Trail & Visual Casing Conventions
When reading unfamiliar Veko code, scan for the word mut. Because Veko requires mut at both the declaration and every mutating call site (bytes/push mut buf 10), any line without mut is guaranteed not to mutate its arguments in place.
- Naming convention: Stick to Veko's visual casing and hyphenation split —
kebab-casefor functions and words (encode-header),snake_casefor local variables and struct fields (out_path), andPascalCasefor types (Upstream). That lets your eye distinguish callable words from values immediately without()at call sites.
1. Build, Test, and Render Documentation
Run the Test Suite
veko run tests/run_tests.vk
This verifies:
- Whitespace-aware lexical disambiguation (
tightvsspacedbrackets, dot-chains, enums, unary-, binary-). - Two-pass Pratt precedence (
hash a == hash b, CRC bitwise indexing, multiline\pipes). - Optional gradual and strict types,
struct { ... }andinterface { ... }definitions, and static + runtime.secretfirewalls. - O(1)
put, CoW isolation, fixed-width 64-bitVKObytecode roundtripping,veko inspectmodes, HTML documentation synthesis, and 3-track parity.
Build Everything in One Step
# Refresh HTML documentation only (dist/docs/)
veko docs
# Or run the pure-Veko build orchestrator (`all`, `test`, `docs`, `build`, `fixed-point`, `check`)
veko run build.vk -- all
Running veko run build.vk -- all executes static checks, runs tests/run_tests.vk, refreshes both HTML documentation suites in dist/docs/, and verifies the two-stage S1 == S2 native self-hosting fixed point (dist/bin/veko).
Render Documentation Only
veko docs
2. Inspect Tokens and ASTs While Writing .vk Code
Use veko inspect to see exactly how the whitespace-aware lexer and two-pass Pratt parser interpret your source file:
# Inspect raw tokens with line:col and [tight] / [spaced] flags
veko inspect --tokens examples/tour.vk
# Inspect the resolved two-pass AST
veko inspect --ast examples/tour.vk
# Inspect compiled 64-bit VKO bytecode
veko inspect --bytecode examples/hello.vk
# Execute a script or launch the interactive REPL
veko run examples/hello.vk
veko repl
Understanding [tight] vs [spaced] in Token Output
| Source Snippet | Lexer Output | Meaning |
|---|---|---|
buf[0..n] |
lbracket([) [tight] |
Postfix index/slice on buf |
if ok [break] |
lbracket([) [spaced] |
Homoiconic code block argument to if |
node.url |
dot_chain(url) [tight] |
Field read or 1-arg UFCS call on node |
mode = .tls |
enum_lit(tls) [spaced] |
Shorthand enum symbol .tls |
total = a - b |
minus(-) [spaced] |
Binary subtraction |
add x -1 |
int_lit(-1) [spaced] |
Negative integer literal |
3. Write Order-Independent Functions and Aliases
Pass 1 of the Veko parser scans fn, macro, def, and use declarations before Pass 2 builds expression trees. You can call helpers defined lower in the same file without forward declarations:
use [h = net/http, j = json]
def fetch-fast = h/fetch/timeout
main = fn [url] [
format-result (fetch-fast url 5s \ j/decode)
]
format-result = fn [data] [
data.status
]
4. Avoid Common Syntax Traps
- Always put spaces around binary
-and/:a - bis subtraction;a-bis a single kebab-case identifier.- If you accidentally write
n-1whennis in scope, Veko reports:
unknown word 'n-1' -- add spaces for subtraction: 'n - 1'.
- Use
{ ... }for maps and structs,[ ... ]for blocks and lists:- Struct definition:
Node = struct { url str, port i64 = 443 } - Struct literal:
Node { url = 'https://veko-lang.org', port = 8443 } - List or code block:
[1 2 3]or[print 'ok']
- Struct definition:
- Mark in-place mutations with
muton both sides:- Signature:
trim-buf = fn [mut buf] [ ... ] - Call site:
trim-buf mut pkt
- Signature:
5. Configure vvm for WebAssembly 3.0 Execution (--wasm)
When executing veko run --wasm <file.vk>, Veko compiles your program to validated WebAssembly 3.0 and launches vvm automatically (discovering ../vvm/dist/bin/windows/vvm.exe, ../vvm/dist/bin/linux/vvm, dist/bin/vvm, or VVM_BIN when set):
# Optional override if your vvm binary lives in a custom path
$env:VVM_BIN = "C:\path\to\vvm.exe"
veko run --wasm --check-slabs examples/hello.vk
You can also invoke vvm run --veko directly against .wasm artifacts emitted by veko compile --wasm.
6. Structure Multi-File Projects & Compile .vko Modules
- Create a
veko.vkmanifest at your project root specifyingname, relativeroot(e.g.,'src'), optional externaldeps, and optionalallow-caps = [.fs .clocks .env .net .exec .ui](plus default-deny.ffionly when explicitly integrating native shared libraries). - Export types, functions, and macros explicitly using
pub Type = struct {...},pub name = fn|macro [...] [...], orexport [sym1 sym2]—mutable module globals (pub mut) are rejected by design. - Import using logical names (
use [c = lib/codec, auth]); Veko checks reserved built-in namespaces first, projectrootsecond, standard librarylib/third, and declareddepsfourth. - Audit before running: Run
veko inspect --modules src/main.vkto verify topological order, public exports, and transitive capabilities, or compile ORO VM bytecode modules viaveko compile --vko mod.vk -o mod.vkoand inspect them withveko inspect --vko mod.vko.
7. Run Concurrent Workers & Guarded Networking
- Fan out work across isolated
spawntasks: Pass read-only config/values or transfer payloads via boundedchan/newqueues (chan/send,chan/recv,chan/select), and collect results deterministically usingtask/await. - Respect ORO isolation boundaries: Keep
mutbuffers local to one task (spawnrejects outermutcaptures), and tag sensitive keys withbytes/with-secretso channel/network firewalls block accidental leaks. - Authorize networking explicitly when needed: Networking stays disabled by default on VM/Wasm (
allow_network = false); enable only required permissions at runtime (veko run --allow-net --allow-listen --allow-private-net examples/14_http_json_api_server.vkor--allow-hosts=api.example.com), or run cached native binaries viaveko run --native.
8. Choose Backends & Cross-Compile veko Across All Five Native Targets
Choosing Between Veko's Three Execution Tracks
Write idiomatic .vk code once and select the runtime envelope matching development speed, isolation, or native deployment.
When to Choose --vm/.vko, --wasm, or --native
- Choose
--vmor.vkofor instant local iteration,veko repl, dynamiceval, and precompiled 64-bitVKOdistribution. - Choose
--wasmwhen executing untrusted or multi-tenant code undervvm'sHostSandbox(fuel caps,--mem-pages,--allow-fs,--allow-hosts,--check-slabs). - Choose
--native(veko run --nativeorveko compile --native [--target=<win-x64|win-arm64|linux-x64|linux-arm64|macos-arm64>]) when shipping standalone Windows PE32+ (win-x64&win-arm640xAA64,--guioptional), static Linux ELF64 (x86_64&arm64), or signed 16 KiB Apple Silicon Mach-O (macos-arm64) binaries with zero C/LLVM toolchain dependencies.
src/main.vk hosts the unified 46-module single-binary veko SDK (with all 93 lib/ modules embedded via src/stdlib_vfs.bin) and compiles projects (including itself) to all targets:
# Compile the self-hosted veko toolchain to .vko, .wasm, or any of the 5 native OS/CPU targets
veko compile --vko src/main.vk -o dist/veko.vko
veko compile --wasm src/main.vk -o dist/veko.wasm
veko compile --native src/main.vk -o dist/bin/veko_s1.exe
veko compile --native --target=win-arm64 src/main.vk -o dist/bin/veko_win_arm64.exe
veko compile --native --target=linux-x64 src/main.vk -o dist/bin/veko_linux_x64
veko compile --native --target=linux-arm64 src/main.vk -o dist/bin/veko_linux_arm64
veko compile --native --target=macos-arm64 src/main.vk -o dist/bin/veko_macos_arm64
9. Predictable Memory, Zero Pauses, Zero Lifetimes: How ORO Works in Plain English
Veko's memory model is called ORO (One Reference Only). In plain English, Veko gives you the clean feel of a high-level language with the predictable memory and speed of systems code — without garbage-collection pauses and without lifetime annotations:
- Zero-GC (No Garbage Collector): Unlike Python, Go, Java, or JavaScript, Veko runs no background collector thread that periodically pauses your service to scan memory for unreachable objects.
- One Clear Owner ("Passing a Physical Clipboard"): Instead of a "Shared Google Doc" where ten distant functions hold hidden references and silently mutate your map behind your back, every Veko value has one clear owner at a time:
- Reading is free: Passing a value to a read-only function costs zero copying.
- In-place updates are explicit (
mut): If a function updates your buffer in place, you passmuton the page (bytes/push mut buf 10), and ownership returns immediately when the call completes. - Independent copies use Copy-on-Write: Assigning
snapshot = draftshares the underlying slab safely until one variable actually mutates it, and strings up to 14 bytes live inline inside the 16-byte value with zero heap allocation.
- Deterministic Cleanup & True Secret Zeroization: Because every value has one owner, Veko knows the exact closing
]where a variable goes out of scope:
handle-webhook = fn [payload bytes] str [
// 1. <= 14-byte strings sit inline on registers/stack — 0 heap allocations
status = 'verified'
// 2. Explicit in-place mutation: any line without `mut` CANNOT mutate `buf`
mut buf = bytes/with-cap 256
bytes/push-all mut buf payload
// 3. Single-owner secrets zeroize deterministically at scope exit
api_key = os/getenv/secret/or 'STRIPE_SECRET' [ bytes/with-secret 0 ]
status
] // <-- Right here: `buf` is freed immediately, and `api_key` RAM bytes are overwritten with 0x00!
| Your Background | What Zero-GC ORO Determinism Means in Practice |
|---|---|
| Python / Node / Ruby | Services run in 15–30 MB of RAM instead of 500 MB, never suffer random GC latency spikes, and functions cannot silently mutate your maps or lists. |
| Go | Same single-binary compile-and-ship workflow, with zero GOGC/GOMEMLIMIT tail-latency tuning, zero nil panics, and explicit mut on state changes. |
| Rust | Deterministic RAII drops, single-owner safety, and zero GC — without <'a> lifetime annotations, Rc<RefCell<T>>, or Arc<Mutex<T>>. |
| Security & FinTech | A moving garbage collector never copies passwords or keys across RAM; single ownership lets Veko zeroize secret slabs at the exact closing ]. |
10. Coming from Python, TypeScript, Go, or Rust: Stack Migration Map
Use veko pkg search <query> and veko pkg info <name> to discover any of the 30 official Ed25519-signed .vkp packages on veko-lang.org:
| Familiar Stack in Other Ecosystems | Idiomatic Pure-Veko Stack (stdlib + veko pkg add ...) |
|---|---|
Python: FastAPI + Pydantic + Celery + Chroma/Polars |
web + openapi@1.0.0 + jobs_cron@1.0.0 + vec_rag@1.0.0 / dataframe_parquet@1.0.0 |
TypeScript / Node: Next.js + Prisma + Stripe + Apollo + Playwright + Yjs |
web_live@1.0.0 + db/sqlite (sqlite_orm_ext@1.0.0) + payments_ledger@1.0.0 + graphql@1.0.0 + browser_cdp@1.0.0 + crdt_sync@1.0.0 |
Go: net/http + chi + grpc-go + ko + client-go + etcd/raft |
web (net/http2, net/http3) + http_router@1.2.0 + grpc_proto@1.0.0 + oci_k8s@1.0.0 + cluster_raft@1.0.0 |
Rust: axum + tower + snow (Noise) + extism + rumqttc |
web + resilience@1.0.0 + noise_tunnel@1.0.0 + wasm_plugin_sdk@1.0.0 + iot_mqtt@1.0.0 |
Enterprise / DevOps: boto3 + Ansible/Terraform + Okta SAML/SCIM + WebAuthn |
cloud_s3@1.0.0 + iac_fleet@1.0.0 + ldap_saml@1.0.0 + webauthn@1.0.0 + ai_mcp@1.0.0 + ai_llm@1.0.0 |
Part V: Veko — Developer Tooling Guide (debug, --coverage, fuzz, fmt, lsp, VS Code & pkg)
Veko ships its entire developer experience inside the single self-hosted veko executable with zero external runtime dependencies: an interactive CLI source debugger & VS Code F5 Debug Adapter Protocol server (veko debug, veko debug --dap), compiler-verified line coverage (veko test --coverage, --lcov), deterministic structure-aware fuzzing & counterexample shrinking (lib/testing/fuzz.vk), a whitespace-safe formatter (veko fmt), a native Language Server Protocol 3.17 server (veko lsp), self-contained HTML API docs with live Wasm 3.0 <canvas> previews (veko doc --html), Light-Mode SVG flamegraphs (--flamegraph), veko-lang.org + decentralized HTTPS .vkp package management (veko pkg add, ~/.veko_modules, veko.lock), and assisted Go/Python/Rust/V migration translators.
Self-Hosted Formatter, LSP Server, Doctest Runner & Source Migrators
Every IDE, formatting, documentation, package-signing, and code-migration tool ships inside the single veko binary.
1. Canonical Source Formatter (veko fmt)
veko fmt enforces consistent tab indentation for [ ... ] and { ... } blocks, continuation \ pipe alignment, LF line endings, trimmed trailing whitespace, and single blank-line separation while strictly preserving Veko's load-bearing [tight] vs [spaced] token boundaries, single-quoted strings, and // comments.
# Print formatted output to stdout
veko fmt src/app.vk
# Format a file or entire directory tree in place
veko fmt --write src/
# CI gate: exit non-zero if any .vk file needs formatting
veko fmt --check src/ lib/ examples/
# Preview a unified diff without modifying files
veko fmt --diff src/app.vk
Formatting is guaranteed idempotent: running veko fmt twice produces byte-identical output.
2. Native Language Server (veko lsp)
veko lsp runs a pure-Veko JSON-RPC 2.0 Language Server over standard input/output (Content-Length framing). Any LSP-compatible editor (VS Code, Neovim, Helix, Zed) can launch veko lsp directly with no Node.js or external language server binary.
| LSP Feature | Method | Capabilities |
|---|---|---|
| Live Diagnostics | textDocument/publishDiagnostics |
Lexer, parser, gradual/strict types, mut borrow rules, .secret sinks, and veko.vk capability checks on open/change/save |
| Hover Documentation | textDocument/hover |
Signatures and // doc comments for local symbols, imported stdlib modules (doc_cmd), and core Veko keywords |
| Go to Definition | textDocument/definition |
Jumps to top-level fn, struct, and constant definitions in the current file or imported modules |
| Contextual Completion | textDocument/completion |
Triggered on /, ., and \: module exports (dt/), enum literals (.ok, .fs, .exec), local defs, and Veko builtins |
| Document Outline | textDocument/documentSymbol |
Structured outline of top-level functions, structs, and values |
| Canonical Formatting | textDocument/formatting |
Formats documents directly via veko fmt |
| Quick-Fix Code Actions | textDocument/codeAction |
Turns 'did you mean ...' diagnostics into 1-click workspace edits |
Connecting Other Editors to veko lsp
Because veko lsp speaks standard JSON-RPC 2.0 over stdio, non-VS Code editors connect with a few lines of configuration:
- Helix (
~/.config/helix/languages.toml):
[language-server.veko-lsp]
command = "veko"
args = ["lsp"]
[[language]]
name = "veko"
scope = "source.veko"
file-types = ["vk"]
comment-token = "//"
indent = { tab-width = 4, unit = "\t" }
language-servers = ["veko-lsp"]
auto-format = true
- Neovim (
init.lua— built-invim.lsp.start):
vim.filetype.add({ extension = { vk = "veko" } })
vim.api.nvim_create_autocmd("FileType", {
pattern = "veko",
callback = function(ev)
vim.lsp.start({
name = "veko-lsp",
cmd = { "veko", "lsp" },
root_dir = vim.fs.dirname(vim.fs.find({ "veko.vk", ".git" }, { upward = true })[1] or ev.file),
})
end,
})
3. Visual Studio Code Extension (editors/vscode/)
The repository includes a zero-dependency VS Code extension in editors/vscode/ (also packaged as an installable veko-lang-1.0.0.vsix bundle with zero Node build step or external language server installation required).
3.1 Installing the Extension
Choose one of the following installation methods:
- Install Packaged
.vsixBundle (Recommended for End Users):
code --install-extension veko-lang-1.0.0.vsix
- Windows (PowerShell — Copy from Repository):
Copy-Item -Recurse -Force .\editors\vscode "$env:USERPROFILE\.vscode\extensions\veko-lang"
- Linux / macOS (Symlink — Auto-Tracks Repo Updates):
ln -s "$(pwd)/editors/vscode" "$HOME/.vscode/extensions/veko-lang"
- Try Immediately Without Installing:
code --extensionDevelopmentPath=./editors/vscode .
After copying or symlinking, reload VS Code (Ctrl+Shift+P / Cmd+Shift+P -> Developer: Reload Window).
3.2 Configuring VS Code Settings
Open Settings (Ctrl+,) or edit your User/Workspace settings.json to point the extension at your self-hosted veko binary and enable canonical tab-based format-on-save:
{
"veko.executablePath": "dist/bin/veko.exe",
"veko.strictTypes": false,
"[veko]": {
"editor.formatOnSave": true,
"editor.insertSpaces": false,
"editor.tabSize": 4
}
}
- Set
veko.executablePathto"veko"if the binary is already on yourPATH, or an absolute path such as"/path/to/veko/dist/bin/veko"on Linux. - Set
"veko.strictTypes": trueif you want Veko: Check Types & Secrets to enforce--strict-typesby default.
3.3 Using the Extension (LSP, CodeLens & Command Palette)
Opening any .vk file automatically activates syntax highlighting and starts veko lsp in the background:
- Editor Intelligence: Hover over functions, structs, or stdlib paths (
datetime/parse-rfc3339) for live signatures & docs; press F12 for Go to Definition; trigger completion on/,., and\; press Shift+Alt+F to format viaveko fmt; click the lightbulb (Ctrl+.) to apply 1-click'did you mean?'quick-fixes. - Top-of-File CodeLens Bar: Every
.vkfile displays one-click links at line 1:Run (VM),Run (Wasm),Check,Docs,Doctest, andInspect. - Visual Inspector Side Panel (
Veko: Open Visual Inspector): Opens a theme-aware Webview panel beside your editor with 5 switchable tabs (--tokens,--ast,--modules,--bytecode,--wasm), live token filtering, color-coded[tight]vs[spaced]whitespace badges, click-to-jump from any token row directly to itsline:colin the editor, and automatic refresh whenever you save the.vkfile.
![Veko Visual Inspector Side Panel — Interactive [tight] vs [spaced] Token Table Alongside .vk Source](../screenshots/vscode_02_visual_inspector_light.png)
- Command Palette (
Ctrl+Shift+P-> typeVeko:):
| Command | CLI Equivalent | Purpose |
|---|---|---|
| Veko: Run Current File | veko run <file> |
Execute active .vk file on the 64-bit ORO VM |
| Veko: Debug Current File (F5) | veko debug --dap |
Launch interactive VS Code F5 DAP debugging with breakpoints, call stacks, expandable structs/maps, and <secret> redaction |
| Veko: Run in Wasm 3.0 Sandbox | veko run --wasm <file> |
Execute active .vk file inside vvm Wasm 3.0 |
| Veko: Check Types & Secrets | veko check [--strict-types] <file> |
Run static gradual/strict types, mut borrow, and .secret checks |
| Veko: Format Document | veko fmt (via LSP) |
Format active buffer canonically in place |
| Veko: Show API Docs for Current File | veko doc <file> |
Display extracted // API signatures, capabilities, and examples |
| Veko: Look Up Module / Symbol Docs | veko doc <mod> [sym] |
Prompt (pre-filled from cursor) to look up any stdlib or workspace symbol |
| Veko: Export API Docs (api.json) | veko doc --json <file> -o <file>.api.json |
Write machine-readable JSON API docs alongside the file |
| Veko: Export API Docs (Markdown) | veko doc --md <file> -o <file>.api.md |
Write Markdown API reference alongside the file |
| Veko: Run Doctests | veko doc --test <file> |
Execute all fenced vk ` doctests in the current file |
| Veko: Build HTML Documentation & Playground | veko docs |
Regenerate all End-User & Technical HTML handbooks into dist/docs/ |
| Veko: Open Visual Inspector | veko inspect --tokens|--ast|--modules|--bytecode|--wasm <file> |
Open the interactive side-by-side Visual Inspector Webview with live tabs, [tight]/[spaced] badges, click-to-jump tokens, and auto-refresh on save |
| Veko: Inspect Tokens / AST / Modules / Bytecode / Wasm | veko inspect <flag> <file> |
Open the Visual Inspector directly on the chosen tab |
3.4 Troubleshooting
- No diagnostics or hover appearing: Open View -> Output and select the
Vekochannel. Verify thatveko.executablePathpoints to a working binary (veko versionworks in your terminal). - Spaces instead of tabs on Enter: Confirm
"[veko]": { "editor.insertSpaces": false }is set insettings.jsonso VS Code matchesveko fmt's canonical tab indentation.
4. API Docs, Doctests & Interactive Web Playground (veko doc & veko docs)
4.1 Terminal, Self-Contained HTML & Doctest API Docs (veko doc)
- Live API Lookup: Run
veko doc <module> [symbol]in your terminal (e.g.veko doc datetime parse-rfc3339orveko doc ui open-window) to inspect signatures, capabilities, and examples directly from source//comments. - Self-Contained Light-Mode HTML API Docs: Render any module or workspace into a zero-CDN, single-file HTML reference (
veko doc --html -o api_docs.html lib/ui.vk) or multi-page directory (veko doc --html --out-dir=dist/api lib/) complete with live symbol search, Wasm 3.0 executable doctest cells, and interactive<canvas>RGBA32 framebuffer previews:
- Machine-Readable Exports: Emit
api.json(veko doc --json <mod> -o api.json) or Markdown (veko doc --md <mod> -o api.md). - Multi-Track Doctests: Verify every fenced
vkexample across VM, Wasm 3.0 (--check-slabs), and Native x86_64 / ARM64 viaveko doc --test [--vm|--wasm|--native|--all] <mod>...`.
4.2 Building & Using the Interactive Web Documentation Playground
Every Veko documentation site generated by veko docs includes a built-in, zero-CDN Interactive Code Playground embedded directly on every Veko code block:
- Generate the HTML documentation suite:
veko docs
This renders standalone End-User HTML pages into dist/docs/user/index.html (and Technical docs into dist/docs/technical/index.html).
- Open in any browser (works offline via
file://or over HTTP):
# Windows
Start-Process dist\docs\user\index.html
# Linux / macOS
xdg-open dist/docs/user/index.html
- Use the Code Cell Toolbar: Above every Veko snippet you will see a
VEKOheader bar with two buttons:Copy— Copies the snippet directly to your clipboard.Playground— Opens an editable code cell right below the snippet with three controls:Inspect Tokens— Runs the built-in browser Veko tokenizer live on your edits and prints every token with its exact[spaced]vs[tight]whitespace tag (enum_lit,path,str_lit,word,delim). This is ideal for learning and debugging Veko's whitespace rules interactively.Run (Wasm / CLI)— If a browser Wasm runner hook (window.VEKO_WASM_RUNNER) is attached on the host page, executes your edited code live in-browser and prints stdout; otherwise displays the exact offlineveko check/veko run --wasm/veko fmt --diffcommands to run locally.Reset— Restores the cell back to the original documentation example.
- Optional Custom Wasm / Local Runner Hook: When hosting
dist/docs/user/behind a web app or Wasm bridge, define a single function beforeinteractive.jsruns:
window.VEKO_WASM_RUNNER = function(sourceCode) {
return myVekoRuntime.eval(sourceCode);
};
All Run (Wasm / CLI) buttons across every documentation page automatically invoke window.VEKO_WASM_RUNNER(sourceCode) and display its output inline.
5. Call-Frame Profiling, Light-Mode SVG Flamegraphs & veko.lock
5.1 Deterministic Call-Frame Profiler (--profile & --flamegraph)
veko run and veko bench include a zero-overhead-when-disabled call-frame profiler (lib/profile/flamegraph.vk) that records exact call counts, self nanoseconds, and inclusive call stacks across qualified Veko functions:
# Print top hot functions by self/inclusive time and emit an interactive Light-Mode SVG flamegraph
veko run --flamegraph=dist/profile.svg src/main.vk
veko bench --flamegraph=dist/bench_flame.svg tests/
5.2 Interactive Source Debugger & VS Code F5 DAP (veko debug)
veko debug provides both an interactive terminal source debugger ((veko-dbg)) and a zero-dependency Debug Adapter Protocol server (veko debug --dap) wired directly into VS Code's F5 debugger (editors/vscode/):
# Interactive CLI debugger (pause on entry or at explicit -b breakpoints)
veko debug examples/38_zero_ffi_sqlite_and_orm.vk
veko debug -b 18 --script="bt;locals;n;c" examples/38_zero_ffi_sqlite_and_orm.vk
- Interactive Commands:
s/step(step into),n/next(step over),f/finish(step out),c/continue,b [file:]line,d <id>,bt(stack trace),locals,globals,p <expr>(evaluate local, dotted field, or expression), andl(source window). - End-to-End
.secretRedaction: Every.secretbinding, struct field, or map entry automatically renders as<secret>across CLIlocals/print, VS Code Variables panes, and hover tooltips—preventing accidental credential exposure during debugging sessions.
5.3 Compiler-Verified Line Coverage & Structure-Aware Fuzzing (veko test --coverage & testing/fuzz)
veko test --coverage records exact VKO source-line hits per module, prints a terminal coverage summary, writes optional LCOV (--lcov=dist/lcov.info) for CI gutters, and renders a self-contained Light-Mode HTML Coverage Report:
veko test --coverage=dist/coverage.html --lcov=dist/coverage.info examples/39_debugger_coverage_and_fuzzing.vk
Pair line coverage with lib/testing/fuzz.vk (fuzz-bytes, fuzz-str, fuzz-block) to run deterministic SplitMix64 property campaigns across --vm, --wasm, and --native with automatic delta-debugging counterexample shrinking down to minimal failing byte slices, UTF-8 strings, or nested homoiconic [ ... ] blocks.
5.4 Single-Binary Portable SDK, veko-lang.org Registry & ~/.veko_modules (veko pkg)
All 95 standard library modules are embedded inside the single veko binary (stdlib_vfs.vk across all 5 native SDK targets: win-x64, win-arm64 PE32+ 0xAA64, linux-x64, linux-arm64, and macos-arm64, distributed for Windows as veko-1.0.0-win-x64.zip and veko-1.0.0-win-arm64.zip), while environment variables and ~/.veko_modules keep host configuration clean and predictable:
| Path / Variable | Purpose |
|---|---|
Embedded VFS (stdlib_vfs.bin) |
Built-in compressed stdlib inside veko so veko run, veko compile, and veko doc work anywhere with zero external directories |
VEKO_HOME |
Optional SDK root override ($VEKO_HOME/lib overrides stdlib modules; $VEKO_HOME/bin locates vvm) |
~/.veko_modules (VEKO_MODULES) |
User-level cache (cache/<sha256>.vkp) and installed package store (pkgs/<name>@<ver>.vkp) shared across workspaces |
VEKO_LIB |
Native shared library search path (; on Windows, : on Linux/macOS) consulted by lib/ffi.vk (ffi/open-lib) |
https://veko-lang.org/pkg (VEKO_REGISTRY) |
Official HTTPS .vkp registry for bare name@ver specs alongside decentralized https://... .vkp URLs |
# Add an official package from https://veko-lang.org/pkg/<name>/<ver>.vkp or any decentralized HTTPS URL
veko pkg add http_router@1.2.0
veko pkg add https://example.org/veko/custom_codec-0.4.0.vkp
# List cached ~/.veko_modules packages, write veko.lock, or verify in CI
veko pkg list
veko pkg lock
veko pkg fetch
veko pkg verify-lock
6. Assisted Migration Translators (veko go2vk, py2vk, rs2vk, v2vk & migrate)
Veko includes built-in assisted translators for Go, Python, Rust, and V that rewrite core syntax into canonically formatted Veko starter files AND automatically map standard libraries and popular ecosystem packages directly onto Veko's 93-module pure-.vk standard library (use [...]):
# Direct language shorthands
veko go2vk path/to/service.go -o src/service.vk
veko py2vk path/to/script.py -o src/script.vk
veko rs2vk path/to/module.rs -o src/module.vk
veko v2vk path/to/legacy_mod -o src/migrated.vk
# Unified command (auto-detects by extension or explicit --from=go|py|rust|v)
veko migrate --from=go path/to/service.go -o src/service.vk
Automatic Standard Library & Dependency Mapping
| Domain | Go (go2vk) |
Python (py2vk) |
Rust (rs2vk) |
Veko use [...] Target |
|---|---|---|---|---|
| HTTP Client & Web | net/http |
requests, httpx, flask, fastapi |
reqwest, axum, actix_web, warp |
hc = net/client, web |
| HTML & Templates | html/template, text/template |
html, jinja2 |
maud, askama |
html, tpl = template |
| Date & Time | time |
datetime, time |
chrono, std::time |
dt = datetime |
| Filesystem & Paths | os, io/fs, path/filepath |
os, pathlib, shutil |
std::fs, std::path |
fs, path |
| JSON / TOML / CSV | encoding/json, BurntSushi/toml, encoding/csv |
json, tomllib, csv |
serde_json, toml, csv |
builtin json, toml = codec/toml, csv = codec/csv |
| Crypto & TLS 1.3 | crypto/sha256, crypto/aes, crypto/ed25519, crypto/tls |
hashlib, hmac |
sha2, sha3, blake2, aes_gcm, ed25519, rustls |
crypto/{sha256,sha3,blake,aes,x25519}, tls13 = net/tls13 |
| Auth (JWT & TOTP) | golang-jwt/jwt, pquerna/otp |
pyjwt, pyotp |
jsonwebtoken |
jwt = auth/jwt, totp = auth/totp |
| Databases | jackc/pgx, lib/pq, go-redis |
psycopg, redis |
postgres, tokio_postgres, redis |
pg = db/postgres, redis = db/redis |
| Archives & Deflate | archive/tar, archive/zip, compress/gzip |
tarfile, zipfile, gzip, zlib |
tar, zip, flate2 |
tar = archive/tar, zip = archive/zip, deflate = compress/deflate |
| Net, Regex, Logs, CLI | net/netip, gorilla/websocket, regexp, log/slog, google/uuid, semver |
ipaddress, websockets, re, logging, uuid, difflib, tenacity |
std::net, tungstenite, regex, tracing, uuid, clap, semver |
ip = net/ip, ws = net/websocket, regex, slog, rnd = rand, diff, retry, cli, sv = semver |
- Honest Boundary Markers: Foreign or incompatible constructs (
C./ cgo,unsafe,sync.Mutex,Arc<Mutex>,async fn,try/except,shared,veb,sqlite) are always preserved with explicit// TODO(go2vk|py2vk|rs2vk|v2vk): ...comments so nothing is silently mis-translated. - Auto-Formatted Output: Every translator passes its generated
.vkcode throughveko fmt.
7. LLMs & Coding Agents (AGENTS.md, veko init --agents & llms.txt)
Because Veko has a compact prefix grammar, deterministic One Reference Only (ORO) ownership (zero <'a> lifetime loops), <10ms veko check feedback, and offline veko doc <module> introspection across all 95 embedded stdlib modules, LLMs write idiomatic .vk code immediately when AGENTS.md is present in the workspace root.
# Every new workspace created with `veko init` automatically includes AGENTS.md:
veko init my-service
# Add AGENTS.md, CLAUDE.md, .claude/settings.json, .cursor/rules/veko.mdc,
# and .github/copilot-instructions.md to any new or existing project:
veko init --agents .
# Or download the latest standalone AGENTS.md directly from veko-lang.org:
curl -fsSL https://veko-lang.org/AGENTS.md -o AGENTS.md
- Built-In Agent Introspection Loop:
AGENTS.mdteaches coding agents to callveko doc <module>,veko pkg search,veko inspect --tokens,veko init --sync,veko check --strict-types,veko fmt -w, andveko testinstead of guessing signatures. - Web &
@DocsIndexing (llmstxt.org): Indexhttps://veko-lang.org/llms.txtorhttps://veko-lang.org/llms-full.txtin Cursor@Docs, Claude Projects, ChatGPT, or Windsurf for full 95-module stdlib and 30-package context.
8. Environment Diagnostics, CI Scaffolding & Authoring .vkp Packages
veko doctor & veko init --ci
Verify your local SDK, embedded 95-module VKFS archive, ~/.veko_modules cache, veko.vk manifest, AGENTS.md, and registry connectivity in one command, or generate ready-to-push GitHub Actions CI + static container files:
# Inspect local SDK, workspace, AGENTS.md, and HTTPS package registry health
veko doctor
# Generate .github/workflows/veko.yml + multi-stage static ELF64 Dockerfile
veko init --ci .
Publishing & Hosting Signed .vkp Packages in 3 Commands
Any developer or team can author, Ed25519-sign, and host a decentralized static HTTPS .vkp package registry on S3, Cloudflare R2, GitHub Pages, or Nginx with zero server code:
# 1. Scaffold a publish-ready package workspace (src/mod.vk, examples/demo.vk, tests/, README.md, AGENTS.md)
veko init --pkg my_library
# 2. Generate an Ed25519 publisher keypair (prints your public `ed25519:<hex>` trust-key)
veko pkg keygen -o publisher.ed25519.key
# 3. Pack the signed VKP1 bundle & generate static registry catalog.json + trust-keys.json
veko pkg pack my_library/src -o dist/registry/my_library/0.1.0.vkp --key-file=publisher.ed25519.key --name=my_library --version=0.1.0
veko pkg index dist/registry --registry=https://pkgs.example.org
9. Runnable Tooling & Tail-Latency Proof Demos
Run examples/27_tooling_fmt_lsp_and_v2vk.vk and examples/41_oro_latency_and_memory_proof.vk to verify tooling round-trips and p50–p99.9 ORO tail-latency determinism:
veko run examples/27_tooling_fmt_lsp_and_v2vk.vk
veko run -C all examples/41_oro_latency_and_memory_proof.vk
veko bench benchmarks/ --save=dist/bench_baseline.json
Part VI: Standard Library & Post-Quantum Cryptography Guide
Veko ships a 95-module pure-.vk standard library under lib/ (embedded directly inside the single veko binary via stdlib_vfs.vk) that runs identically across all three execution tracks—the 64-bit VKO VM (--vm), the vvm WebAssembly 3.0 sandbox (--wasm), and standalone native x86_64 & AArch64 executables (--native). Every pure data, codec, archive, fuzzing, and cryptographic module requires zero host capabilities, while connected modules (io/*, net/*, reactor, web, db/*, durable/*, ui/*, ffi) declare fine-grained capabilities (allow-caps).
Pure-Veko Standard Library & Post-Quantum Cryptography Architecture
1,043 exported structs and functions across 79 modules — from core data structures to NIST FIPS 203/204/205 PQC.
1. Complete 95-Module Standard Library Map
| Category | Modules (use [...]) |
Highlights | Dedicated Guide / Demo |
|---|---|---|---|
| Developer Harness, Fuzzing & Profiling | fmt, cli, testing, testing/fuzz, datetime, slog, diff, semver, retry, template, profile/flamegraph |
Templates, IEC sizes, hexdumps, CLI subcommands, test/bench runner, SplitMix64 byte/UTF-8/homoiconic-block fuzzing & shrinking, RFC 3339 timestamps, structured logs, Myers diff, SemVer 2.0, backoff, interactive Light-Mode SVG flamegraphs |
examples/17_stdlib_cli_fmt_and_collections.vk, examples/39_debugger_coverage_and_fuzzing.vk |
| Core Math, Text & Collections | math, bits, text, text/re, utf8, path, fs, seq, coll, rand |
Checked/sat math, IEEE-754 transcendentals, CRC-32/Adler-32/varints, Unicode UTF-8, capture-group Thompson NFA text/re, safe path confinement, high-level fs, merge sort, Set/Ring/Heap/Lru/Memo, UUID v4/v7 |
examples/17_stdlib_cli_fmt_and_collections.vk, examples/36_regex_captures_zstd_and_otel.vk |
| Buffers, Streams, Regex & Dialects | buf, io, io/{fs,net,open}, glob, regex, dialect |
ByteReader/ByteWriter/StringBuilder, polymorphic io/Stream & SchemeMux, linear-time ** globbing, ReDoS-proof Thompson NFA regex, homoiconic dialect rewriters |
examples/18_io_streams_regex_and_codecs.vk |
| Codecs, Compression, PNG & Packages | codec/{wire,hex,url,csv,ini,toml,vbin,cbor,http1,http2,http3,der,pem}, compress/{deflate,zstd}, image/png, archive/{tar,zip}, pkg/{vkp,lock} |
Schema binary framing, Hex/Base64, URLs, CSV, INI, TOML, VBIN, CBOR, HTTP/1.1, HTTP/2 + HPACK + Huffman, HTTP/3 + QPACK, ASN.1 DER, PEM, DEFLATE/zlib/gzip, RFC 8878 Zstandard, lossless RGBA32 PNG, TAR/ZIP, signed VKP1 + veko.lock |
examples/25_batteries_datetime_fs_archives_and_toml.vk, examples/37_clipboard_x11_flamegraph_and_lock.vk |
| Classical Crypto & Sealing | crypto/{sha256,sha3,blake,aes,chacha20,kdf,seal,sig,x25519,x509} |
SHA-256/384/512, HKDF, FIPS 202 SHA3/SHAKE, BLAKE2b, AES-128/256-GCM, ChaCha20 & XChaCha20-Poly1305, PBKDF2, Argon2id, pub sealed Sealed + zeroizing unseal, X25519, Ed25519, P-256/P-384, RSA-PSS, X.509 |
examples/19_modern_crypto_and_sealed_vault.vk |
| NIST Post-Quantum Crypto | crypto/{mlkem,mldsa,slhdsa} |
FIPS 203 ML-KEM-512/768/1024, FIPS 204 ML-DSA-44/65/87, FIPS 205 SLH-DSA-SHA2/SHAKE |
examples/20_post_quantum_nist_pqc.vk |
| Networking, Web, Auth, OTel & Zero-FFI DBs | reactor, conc/scope, otel, net/{dns,ip,client,tls13,http2,http3,websocket}, web, html, auth/{jwt,oauth2,totp}, db/{sqlite,kv,query,postgres,redis,sidecar} |
Readiness reactor (epoll/kqueue/IOCP), structured task scopes, W3C OpenTelemetry, DNS, Hybrid PQC TLS 1.3 + built-in Let's Encrypt P-256/P-384 CAs, HTTP/2 + Rapid Reset guards, WAN QUIC v1 HTTP/3, streaming web + HEAD + HTML5 DSL, JWT/OAuth2/TOTP, Zero-FFI SQLite 3 (VKJRNL01 crash journal, B-tree indexes, INNER/LEFT JOIN, ORM), WAL KV, pooled TLS PgPool & RESP3 RedisPool |
Net, Web, DB & VKP1, Async & Reactor |
| Durable State, Studio UI/Wayland/X11/TUI & Opt-In FFI | durable, durable/{object,workflow}, tui, ui, ui/{canvas,font,layout,widgets,wayland,x11}, ffi |
Crash-safe Durable Objects & Workflows with retry backoff, DLQs & worker leases, TrueColor diffing TUI, RGBA32 2D canvas, font, flex/grid layout, 33 Studio widgets (code-editor, command-palette, file-picker, Tab focus rings), Win32 + Linux Wayland/X11 + macOS arm64 Cocoa + Wasm <canvas> + clipboard/Hi-DPI, and opt-in .ffi (VEKO_LIB) |
Durable Objects & Workflows, TUI, UI & FFI |
2. Inspecting & Testing Libraries with veko doc
Because Veko extracts documentation directly from source // comments and AST signatures, documentation never drifts from the code:
# View all exported items in a library module
veko doc fmt
# View a single symbol's signature, capability tags, and doctest
veko doc crypto/mlkem keygen-deterministic
# Generate machine-readable api.json or Markdown API docs
veko doc --json fmt cli testing -o dist/api.json
veko doc --md crypto/aes crypto/seal -o dist/crypto_api.md
# Execute ```vk doctests on the 64-bit VKO VM, Wasm 3.0 (--check-slabs), or Native x86_64
veko doc --test --vm fmt cli testing math bits text path seq coll buf io
veko doc --test --native crypto/mlkem crypto/mldsa crypto/slhdsa
veko doc --test --all fmt cli
3. Developer Harness: fmt, cli, and testing
Formatting, Units, Hex Dumps & Tables (fmt)
fmt turns raw numbers, byte buffers, and tabular records into readable output without external dependencies:
use [fmt]
msg = fmt/template 'Synced {name} ({sz}) in {dt}' {
name = 'edge-eu'
sz = (fmt/size 2621440) // '2.50 MiB'
dt = (fmt/dur 12500000) // '12.50 ms'
}
println msg
println (fmt/format 'radix-16={0} padded={1}' [(fmt/int-radix 255 16) (fmt/hex 42 4)])
println (fmt/table ['Node' 'Status'] [['edge-eu' 'READY'] ['edge-us' 'READY']])
Key functions: fmt/format, fmt/template, fmt/int-radix, fmt/hex, fmt/hex-bytes, fmt/size, fmt/dur, fmt/pad-left, fmt/pad-right, fmt/hexdump, fmt/table.
Declarative CLI Parsing (cli)
cli parses --flag=value, --flag value, short flag clusters (-v), repeatable .list flags, subcommands, -- positional arguments, and auto-renders --help text:
use [cli]
spec = cli/CliSpec {
name = 'node-ctl'
version = '1.0.0'
summary = 'Cluster deployment tool'
flags = [
cli/FlagSpec { name = 'port', short = 'p', kind = .i64, default_val = 8443, help = 'Listen port' }
cli/FlagSpec { name = 'verbose', short = 'v', kind = .bool, default_val = false, help = 'Verbose output' }
]
commands = [
cli/CmdSpec { name = 'deploy', summary = 'Deploy a bundle', min_args = 1 }
]
}
res = cli/parse/or spec os/args [
println (cli/render-help spec)
return (err 'invalid arguments')
]
port = cli/flag-i64 res 'port' 8443
Unit Tests & Micro-Benchmarks (testing)
testing provides structured assertion suites (Suite, new, ok, eq, neq, is-err, is-ok, approx, report, finish) and monotonic benchmarking (bench using .clocks):
use [t = testing, m = math]
mut s = t/new 'math-checks'
_ = t/eq mut s (m/gcd 48 18) 6 'gcd'
_ = t/approx mut s (m/sqrt 2.0) m/sqrt2 0.000000000001 'sqrt(2)'
_ = t/report s
4. Core Utilities & Collections: math, bits, text, path, seq, coll, rand
math: Zero-overhead compile-time folded constants (math/pi,math/tau,math/e,math/ln2,math/sqrt2,math/i64-max,math/i64-min), overflow-safe integer math (add-checked,sub-checked,mul-checked,add-sat,sub-sat,clamp-i64,gcd,lcm,pow-i64,isqrt), 64/32-bit bitops (popcount,clz,ctz,rotl64,rotr64,rotl32,rotr32), and pure IEEE-754 double-precision transcendentals (sqrt,exp,ln,log2,log10,pow,sin,cos,tan,atan,atan2,floor,ceil,round,trunc,isnan?,isinf?).bits: 24-bit (get-u24-be/push-u24-be) and signed 16/32-bit wire helpers layered over hardware LE/BE intrinsics, IEEE-754f64-to-bits/bits-to-f64, LEB128push-varint-u64/read-varint-u64+zigzag-encode/zigzag-decode, checksums (crc32,adler32,fnv1a-64), byte search (index-of,starts-with?,ends-with?,xor-in-place!), and constant-time equality (ct-eq?).text: String search & replacement (starts-with?,ends-with?,index-of,last-index-of,replace,replace-all,repeat,trim-prefix,trim-suffix),lines,words, ASCII predicates (ascii-alpha?,ascii-digit?,ascii-alnum?,ascii-hex?,ascii-space?),slugify, and UTF-8 scalar codepoint helpers (utf8-len,utf8-codepoints,utf8-from-codepoints).path: Cross-platform lexical path operations (normalize,join,join-all,dir,base,ext,stem,with-ext,is-abs?,split-parts) plus security-firstpath/confine root relthat rejects absolute paths and..directory traversal attempts.seq: Stable $O(N \log N)$sort/sort-by(merge sort),binary-search,reverse,unique,chunk,zip,enumerate,flatten,take,drop,fold,any?,all?,find,partition,group-by,count-by,range-seq.coll: Five everyday data structures backed by Veko 1.0's hybrid hashedmapand O(1) in-placeput:Set(set-new,set-from,set-add,set-remove,set-has?,set-union,set-intersect,set-diff)Ring(fixed-capacity O(1) FIFO circular buffer:ring-new,ring-push,ring-pop,ring-peek)Heap(binary min-heap priority queue:heap-new,heap-push,heap-pop,heap-peek)Lru(bounded LRU cache:lru-new,lru-get,lru-put,lru-has?)Memo(memo-new,memo-call)
rand: DeterministicSplitMix64+xoshiro256++PRNG (seed,next-u64,range,f64-unit,bytes-fill,shuffle,choose) for reproducible simulations and tests, plus OS/hardware CSPRNG helpers (csprng-bytes,uuid-v4) for cryptographic randomness.
5. Buffers, Streams, Pattern Matchers & Dialects: buf, io, glob, regex, dialect
Cursor Buffers & ORO Streams (buf, io)
buf provides ByteReader (cursor reads for u8, u16/u32/i64 LE & BE, read-bytes, read-str, read-until), ByteWriter, and StringBuilder. io builds ORO-native value-state Streams (mem-stream, read, write, read-all, write-all, copy, close) and an extensible SchemeMux (mux-default with mem://):
use [io]
mux = io/mux-default
mut src = io/mux-open mux 'mem://hello-veko-stream'
mut dst = io/mem-stream (bytes/with-cap 0)
_ = io/copy mut src mut dst 16
println (bytes/to-str (io/read-all mut dst))
Linear-Time Globbing, ReDoS-Proof Regex & Dialects (glob, regex, dialect)
glob: Linear-time dynamic-programming matching for*,**(recursive across/),?, and[a-z]/[!0-9]character classes (glob/match?,glob/filter).regex: Guaranteed $O(N \cdot S)$ Thompson NFA engine—immune to catastrophic backtracking (ReDoS). Supports literals,.,^,$,*,+,?,|,(...),[a-z],[^...],\\d,\\w,\\s(regex/compile,is-match?,find,find-all,replace-all).dialect: Structural tree walker (rewrite-tree,collect),$var/*pattern matcher (match-pattern), clause splitter (split-clauses), and rule compiler (apply-rules) for custom homoiconic DSLs.
6. Wire Formats, Structured Codecs & Compression (codec/*, compress/deflate)
All codecs follow Veko 1.0's "No nil" rules (wire null decodes cleanly to .null, and missing keys/truncated frames return recoverable err values):
codec/wire: Declarative binary packet packing & unpacking (Fieldkinds:.u8,.u16_le,.u16_be,.u32_le,.u32_be,.i64_le,.i64_be,.varint,.f64_be,.bytes_u16_be,.str_u16_be,.raw).codec/hex: Lowercase/uppercase RFC 4648 hexadecimal (encode,encode-upper,decode).codec/url: RFC 3986Urlparser/formatter (parse,format,encode-component,decode-component,parse-query,encode-query).codec/csv&codec/ini: RFC 4180 CSV (parse,parse-records,encode) and.ini/.conf(parse,get,encode).codec/vbin&codec/cbor: Canonical deterministic Veko binary (vbin/encode,vbin/decode) and RFC 8949 deterministic CBOR (cbor/encode,cbor/decode) with sorted map keys and.nullround-trip.codec/http2: RFC 9113 binaryFrameframing (encode-frame,decode-frame,encode-settings,decode-settings) and RFC 7541 HPACK header blocks (hpack-encode,hpack-decode).codec/der,codec/pem,codec/http1: ASN.1 DER TLV encoding/decoding, RFC 4648 Base64 + PEM blocks, and HTTP/1.1 wire framing.compress/deflate: Pure-.vkRFC 1951 DEFLATE (deflateLZ77 + Fixed Huffman with Stored fallback;inflatesupporting Stored, Fixed Huffman, and Dynamic Huffman blocks), RFC 1950zlib-compress/zlib-decompress(with Adler-32 check), and RFC 1952gzip-compress/gzip-decompress(with CRC-32 & ISIZE checks).
7. Classical Cryptography & Sealed Envelopes (crypto/*)
Every cryptographic primitive is implemented in 100% pure Veko with zero OpenSSL or OS crypto DLL dependencies:
- Hash & XOF Families:
crypto/sha256:sha256, streamingsha256-init/sha256-update/sha256-digest,sha384,sha512,hmac-sha256,hmac-sha384,hmac-sha512, and RFC 5869hkdf-*key derivation.crypto/sha3: FIPS 202 Keccak-f[1600] (sha3-256,sha3-512,shake128,shake256, and streamingshake128-init/shake256-init/xof-squeeze).crypto/blake: RFC 7693 BLAKE2b (blake2b,blake2b-256,blake2b-512,blake2b-keyed).
- Authenticated Encryption (AEAD) & Sealed Envelopes:
crypto/aes: Constant-time algebraic AES-128 & AES-256 (zero secret-indexed S-box tables) + NIST SP 800-38Dgcm-encrypt/gcm-decryptwith automatic round-key zeroization (bytes/zeroize!).crypto/chacha20: RFC 8439aead-encrypt/aead-decrypt(12-byte nonce) plushchacha20and 24-byte-noncexchacha20-poly1305-encrypt/xchacha20-poly1305-decrypt.crypto/seal: High-levelpub sealed Sealedenvelope (external code cannot forge or mutate fields) backed by AES-256-GCM + CSPRNG nonces, portableVKSLwire serialization (to-bytes/from-bytes), and RAIIseal/with-openthat unseals plaintext into a callback and scrubs it viadefer [ bytes/zeroize! mut pt ]:
use [seal = crypto/seal]
key = random/bytes 32
env = seal/encrypt key (bytes/from-str 'api-secret-payload') (bytes/from-str 'v1')
wire = seal/to-bytes env
restored = seal/from-bytes wire
n = seal/with-open restored key fn [pt] [ len pt ]
println n // 18 (plaintext buffer is zeroized automatically when callback returns)
- Password KDFs & Signatures:
crypto/kdf:pbkdf2-sha256, memory-hard RFC 9106argon2id, and constant-timeverify-tag.crypto/x25519: RFC 7748 X25519 key agreement and RFC 8032 Ed25519 signing/verification.crypto/sig: RFC 6979 deterministicecdsa-p256-pubkey/ecdsa-p256-sign/ecdsa-p256-verify,ecdsa-p384-verify, RSA PKCS#1 v1.5 & RSA-PSS verification, andpkcs8-extract-private-key.crypto/x509&net/tls13: X.509 v3 certificate parsing/chain validation and pure-.vkRFC 8446 TLS 1.3.
8. NIST Post-Quantum Cryptography (crypto/mlkem, crypto/mldsa, crypto/slhdsa)
Veko ships all three finalized NIST Post-Quantum Cryptography standards natively in pure .vk, built directly atop crypto/sha3 and in-place put NTT polynomial arithmetic:
| Standard | Module | Parameter Sets | Purpose |
|---|---|---|---|
| FIPS 203 (ML-KEM) | crypto/mlkem |
.mlkem512, .mlkem768, .mlkem1024 |
Lattice key encapsulation (KEM) with constant-time implicit rejection on tampered ciphertexts |
| FIPS 204 (ML-DSA) | crypto/mldsa |
.mldsa44, .mldsa65, .mldsa87 |
Module-lattice digital signatures with full rejection sampling & hint verification |
| FIPS 205 (SLH-DSA) | crypto/slhdsa |
.shake_128f, .shake_128s |
Stateless hash-based signatures (WOTS+ + FORS + XMSS hypertree over SHAKE256) |
use [kem = crypto/mlkem, dsa = crypto/mldsa, slh = crypto/slhdsa]
// 1. Quantum-resistant key exchange (FIPS 203 ML-KEM-768)
kp = kem/keygen .mlkem768
enc = kem/encaps .mlkem768 kp.ek
ss = kem/decaps .mlkem768 kp.dk enc.ciphertext // matches enc.shared_secret
// 2. Lattice digital signature (FIPS 204 ML-DSA-65)
skp = dsa/keygen .mldsa65
sig = dsa/sign .mldsa65 skp.sk (bytes/from-str 'release manifest')
ok1 = dsa/verify .mldsa65 skp.pk (bytes/from-str 'release manifest') sig
// 3. Stateless hash-based signature (FIPS 205 SLH-DSA-SHAKE-128f)
hkp = slh/keygen .shake_128f
hsig = slh/sign .shake_128f hkp.sk (bytes/from-str 'root trust anchor')
ok2 = slh/verify .shake_128f hkp.pk (bytes/from-str 'root trust anchor') hsig
9. Runnable Library Demos & Baseline Benchmarks
Explore all standard library modules in action:
# Core harness, math, collections, & PRNG (`fmt`, `cli`, `testing`, `math`, `text`, `path`, `seq`, `coll`, `rand`)
veko run examples/17_stdlib_cli_fmt_and_collections.vk
# Streams, matchers, codecs, & compression (`buf`, `io`, `glob`, `regex`, `dialect`, `codec/*`, `compress/deflate`)
veko run examples/18_io_streams_regex_and_codecs.vk
# Classical crypto & sealed vault (`sha3`, `blake`, `aes`, `chacha20`, `kdf`, `seal`, `sig`)
veko compile --native examples/19_modern_crypto_and_sealed_vault.vk -o dist/19.exe ; ./dist/19.exe
# NIST Post-Quantum Cryptography (`mlkem`, `mldsa`, `slhdsa`)
veko compile --native examples/20_post_quantum_nist_pqc.vk -o dist/20.exe ; ./dist/20.exe
# Connected I/O streams, DNS, Hybrid PQC TLS 1.3 (`X25519MLKEM768`) & HTTP/2
veko run --allow-net --allow-listen --allow-private-net examples/21_io_streams_dns_and_pqc_tls.vk
# Web micro-framework, HS256/EdDSA/ML-DSA-65 JWT, OAuth2 PKCE & RFC 6455 WebSockets
veko run --allow-net --allow-listen --allow-private-net examples/22_web_server_websocket_and_jwt.vk
# Embedded crash-safe KV store, PostgreSQL SCRAM-SHA-256, Redis RESP3 & Sidecar RPC
veko run --allow-net --allow-listen --allow-private-net examples/23_zero_ffi_databases_kv_pg_redis.vk
# Signed `VKP1` package bundles (Merkle tree + Hybrid Ed25519 & ML-DSA-65)
veko run examples/24_signed_vkp_package_bundles.vk
# Baseline performance benchmarks (`benchmarks/bench_suite.vk`)
veko compile --native benchmarks/bench_suite.vk -o dist/bench.exe ; ./dist/bench.exe
See Networking, Web, Databases & Signed Bundles Guide for dedicated walkthroughs of io/{fs,net,open}, net/{dns,tls13,http2,websocket}, web, auth/{jwt,oauth2}, db/{kv,postgres,redis,sidecar}, and pkg/vkp.
Part VII: Veko — Networking, Web, Databases & Signed Bundles Guide
This guide explains how to build connected applications, web services, authentication flows, zero-FFI databases, and cryptographically signed 'VKP1' package bundles in pure Veko across all three execution tracks (--vm / .vko, sandboxed --wasm via vvm, and standalone --native binaries across win-x64, win-arm64, linux-x64, linux-arm64, and macos-arm64).
Unified io/Stream Stack, Hybrid PQC TLS 1.3, Web Router & Zero-FFI Databases
End-to-end network services, HTML5 rendering, and wire-native database drivers running across all three runtimes.
1. OS Platform Layer (os/*, time/unix, net/*) & .exec Capability
Veko provides a uniform, deterministic Platform Abstraction Layer (PAL) across Windows, Linux, macOS Apple Silicon, the ORO VM, and the vvm Wasm 3.0 sandbox:
Wall-Clock Time & Positioned File I/O
| Builtin | Arity | Capability | Purpose |
|---|---|---|---|
time/unix |
0 |
.clocks |
Current UTC wall-clock Unix epoch timestamp in nanoseconds (i64) |
os/stdin / os/stderr |
1 / 1 |
.fs |
Read up to N bytes from standard input / write text to standard error |
os/exit |
1 |
— | Terminate the current process with integer exit code code |
os/cwd / os/temp-dir |
0 / 0 |
.fs |
Query current working directory or host temporary directory |
os/stat / os/read-dir |
1 / 1 |
.fs |
Inspect file metadata ({ size, is_dir, mtime_ns }, returns err if missing) or list directory entries |
os/remove / os/rename |
1 / 2 |
.fs |
Delete a file/empty dir or atomically rename src to dst |
os/open / os/close |
2 / 1 |
.fs |
Open a file handle ('r', 'w', 'rw', 'a') and close it cleanly |
os/pread / os/pwrite |
3 / 3 |
.fs |
Positioned random-access read (fd off len) and write (fd off bytes) |
os/fsync / os/truncate |
1 / 2 |
.fs |
Flush dirty buffers to stable storage / truncate file to exact byte length |
Networking Primitives (net/*)
| Builtin | Arity | Capability | Purpose |
|---|---|---|---|
net/connect-tcp/timeout |
3 |
.net |
Non-blocking TCP connect enforcing a duration deadline (host port 2s) |
net/set-timeout |
2 |
.net |
Apply per-socket read/write I/O timeout duration (sock 5s) |
net/udp-bind |
2 |
.net |
Bind a UDP datagram socket (net/udp-bind '127.0.0.1' 0) |
net/udp-send-to |
4 |
.net |
Send a UDP datagram (sock host port payload_bytes) |
net/udp-recv-from |
2 |
.net |
Receive a UDP datagram ({ data, host, port }; also supports /timeout) |
net/poll |
2 |
.net |
Poll a block of socket handles for readability with a duration timeout |
net/resolve |
1 |
.net |
Resolve a hostname to a block of IP address strings |
Least-Privilege .exec Capability Gate
Subprocess execution (os/exec) is gated by its own dedicated .exec capability rather than .fs. Projects that only read/write files or open sockets cannot spawn external processes unless veko.vk explicitly grants .exec:
{
name = 'my-service'
root = 'src'
allow-caps = [.fs .clocks .net] // os/exec is statically denied at check/compile time
}
2. Connected Streams (io/fs, io/net, io/open) & UUID v7
Every transport in Veko adapts cleanly to the io/Stream interface so higher-level protocols (net/http2, net/websocket, web, db/postgres, db/redis) work identically over memory buffers, files, TCP sockets, or post-quantum TLS 1.3 streams.
use [io, ifs = io/fs, inet = io/net, iopen = io/open, rnd = rand]
// RFC 9562 time-ordered UUID v7 (monotonically sortable by UTC millisecond timestamp)
req_id = rnd/uuid-v7
// Positioned file stream with explicit fsync
mut wf = ifs/open-write 'data/out.bin'
_ = io/write-all mut wf (bytes/from-str 'hello veko')
_ = ifs/sync wf
_ = io/close mut wf
// Unified URI dispatch (`mem://`, `file://`, `tcp://`, `tls://`, `http://`, `https://`)
mut st = iopen/open 'file://data/out.bin'
payload = io/read-all mut st
_ = io/close mut st
3. DNS, Hybrid Post-Quantum TLS 1.3, HTTP/2, WAN QUIC HTTP/3 & WebSockets
All networking protocols are implemented in 100% pure Veko with zero external crypto or TLS DLLs:
net/dns: RFC 1035 wire query encoder (encode-query), response decoder (decode-response),/etc/hosts&/etc/resolv.confparsers (parse-hosts,parse-resolv-conf), UDP resolver (query-udp), and host lookup (resolve-host).io/net/resolve-ipv4resolves hostnames using.netonly (zero.fscapability required).net/tls13&crypto/x509(Hybrid Post-QuantumX25519MLKEM768+ 8 Built-In Public CAs + Custom Roots + Deadlines):- Enable hybrid post-quantum key agreement (
0x11EC= X25519 + FIPS 203 ML-KEM-768) by passingpqc = trueintls13/connectoptions, with full TLS 1.3 cipher suite negotiation acrossAES-128-GCM-SHA256(0x1301),AES-256-GCM-SHA384(0x1302), andChaCha20-Poly1305-SHA256(0x1303). - Validates X.509 chains out of the box against 8 built-in public CA roots (
ISRG Root X1,ISRG Root X2,ISRG Root YE,DigiCert Global Root G2,GTS Root R1,Amazon Root CA 1,USERTrust RSA Certification Authority, andUSERTrust ECC Certification Authority) plus optional custom enterprise trust anchors (ca_file,ca_pem, orextra_roots_pem) across Ed25519 (0x0807), ECDSA P-256 (SHA-256,0x0403), ECDSA P-384 (SHA-384,0x0503), RSA PKCS#1 (SHA-256/384/512), and RSA-PSS (SHA-2560x0804,SHA-3840x0805,SHA-5120x0806), with automaticmtime-basedCertReloaderhot-reloading and5sserver handshake wall-clock deadlines.
- Enable hybrid post-quantum key agreement (
net/http2: RFC 9113 HTTP/2 connection layer overio/Stream(client-open,server-accept,request,serve-conn-opts), flow-controlledio/StreamDATAresponse streaming, andH2ServerOptsDoS protections (max_concurrent_streams,CONTINUATION& HPACK dynamic table caps, and CVE-2023-44487RST_STREAMRapid ResetGOAWAY(ENHANCE_YOUR_CALM)enforcement).net/http3: Pure-Veko RFC 9000/9001/9002/9114 QUIC v1 + HTTP/3 UDP client and server (request,serve-h3) featuring contiguous interval-mergingReassemblyBufstream/CRYPTO reassembly (for multi-packet PQCInitialClientHellos and out-of-order WAN datagrams), RFC 9000 Appendix A.3 packet number reconstruction (reconstruct-pn), multi-rangeencode-ack-ranges, 25ms PTO retransmission withcwndpacing, and post-ClientFinishedHANDSHAKE_DONE.net/websocket: RFC 6455 WebSocket upgrade handshake (client-handshake,server-handshake, pure-Veko SHA-1accept-key) and masked/unmasked framing (write-frame,read-frame).
use [tls13 = net/tls13, h2 = net/http2, h3 = net/http3]
// 1. Multiplexed HTTP/2 over hybrid X25519MLKEM768 TLS 1.3 (built-in public CA roots)
mut cconn = tls13/connect 'veko-lang.org' 443 {
alpn = 'h2'
pqc = true
}
mut tst = tls13/tls-stream cconn
mut h2c = h2/client-open mut tst
resp = h2/request mut h2c 'GET' '/api/v1/health' 'veko-lang.org' {} (bytes/with-cap 0)
_ = tls13/close mut cconn
// 2. Native QUIC v1 HTTP/3 over WAN UDP :443
h3_resp = h3/request 'veko-lang.org' 443 'GET' '/api/v1/health' {} (bytes/with-cap 0)
4. Web Micro-Framework (web) & Authentication (auth/jwt, auth/oauth2)
Web Micro-Framework (lib/web.vk), Streaming Bodies & Multi-Worker HTTPS
web provides a composable HTTP/1.1, HTTP/2, and HTTP/3 router with :param and *wildcard segments, automatic RFC-compliant HEAD dispatch on GET and static routes (preserving Content-Length with zero body bytes), middleware chains, built-in security headers (use-security-headers), 413 Payload Too Large header/body guards (max_header_bytes, max_body_bytes), multipart/form-data parsing, traversal-safe static file & 206 Partial Content Range serving (mount-static, serve-static-range), and streaming responses:
- Streaming Responses (
io/Stream& Positioned Files): Useweb/stream-response(fixedContent-Length),web/chunked-response+web/encode-chunk(Transfer-Encoding: chunked), orweb/stream-file/web/stream-file-range. Static files and byte ranges larger than256 KiBautomatically stream in64 KiBpositionedos/preadchunks across HTTP/1.1 and flow-controlled HTTP/2DATAframes with constant memory footprint. - Non-Blocking Reactor & Multi-Worker HTTPS:
web/serve-reactormultiplexes persistent HTTP/1.1keep-aliveconnections (max_connections,max_reqs_per_conn) on a single OS readiness poller (epoll/kqueue/IOCP), whileweb/serve-httpsandweb/https-accept-loop+web/https-worker-loopscale TLS 1.3 + HTTP/2 + HTTP/1.1 across bounded shared-nothingspawnworker pools.
For building full web applications in 100% pure Veko, lib/html.vk provides both a homoiconic Hiccup-style block DSL ([.div { class = 'card' } [ [.h2 ['Title']] ]]) and a typed component builder (html/Node, html/el, html/div, html/document) that compose seamlessly together with automatic XSS escaping, HTML5 void-tag handling, and javascript:/vbscript: URL sanitization. Pair directly with web/view and web/page:
use [html, web]
service-card = fn [name str, tags block] html/Node [
html/article { class = 'card' } [
(html/h2 {} [(html/text name)])
[.ul (map tags fn [t] [ [.li [t]] ])]
]
]
mut app = web/new-app
web/use-security-headers mut app
web/mount-static mut app '/assets' 'public'
web/get mut app '/dashboard' fn [req web/Request] web/Response [
viewer = web/query-get req 'user' 'guest'
web/page 200 'Veko Dashboard' [] [
[.header [ [.h1 ['Control Plane']] [.p ['Signed in as: ' viewer]] ]]
[.main [ (service-card 'edge-proxy' ['tls13-pqc' 'http2' 'http3']) ]]
]
]
web/get mut app '/releases/:archive' fn [req web/Request] web/Response [
// Streams >256 KiB archives & 206 Range requests in 64 KiB positioned chunks
web/serve-static-range 'downloads' (web/param req 'archive' '') (web/header req 'Range' '')
]
When you prefer string-based templates (e.g., emails or config generation), lib/template.vk renders {{ var }} (auto-escaped in render-html, unescaped via {{{ raw }}}), {{#if cond}}...{{else}}...{{/if}}, and {{#each list}}...{{/each}}.
Unified Pure-Veko HTTP/HTTPS Client (lib/net/client.vk)
net/client provides a single ergonomic HTTP/1.1 + HTTPS (TLS 1.3 / PQC + built-in public CA roots) client working identically across --vm, --wasm, and --native with get, head (zero-body HEAD handling alongside 204/304), post-json, request-batch, get-many, keep-alive ConnPool, automatic redirect following (301/302/303/307/308), timeouts, and transparent gzip/deflate response decompression:
use [hc = net/client]
head_r = hc/head 'https://veko-lang.org/' (hc/RequestOpts { timeout = 5s })
resp = hc/get 'https://veko-lang.org/api/v1/health' (hc/RequestOpts { timeout = 5s, pqc = true })
data = hc/json-body resp
JWT (auth/jwt), OAuth 2.0 PKCE (auth/oauth2) & TOTP 2FA (auth/totp)
auth/jwt: Signs and verifies compact RFC 7519/7515 JWTs usingHS256(sign-hs256/verify-hs256),EdDSAEd25519 (sign-eddsa/verify-eddsa), and post-quantumML-DSA-65(sign-mldsa65/verify-mldsa65). Validatesexp,nbf,iss, andaudagainst live UTCtime/unixviavalidate-claims, and extracts Bearer headers withparse-bearer.auth/oauth2: Generates RFC 7636 PKCES256verifier/challenge pairs (generate-pkce,verify-pkce), CSRFstatetokens (generate-state), authorization URLs (authorize-url), and form-encoded token exchange / refresh payloads (token-exchange-body,refresh-token-body).auth/totp: RFC 4648 Base32 (b32-encode,b32-decode), RFC 4226hotp, RFC 6238totp-at/totp-now/verify-now(constant-time comparison with skew window), andotpauth-uriprovisioning links.
use [jwt = auth/jwt, dsa = crypto/mldsa, oa = auth/oauth2]
// Post-quantum ML-DSA-65 JWT with live expiration check
kp = dsa/keygen .mldsa65
now_s = (time/unix) / 1000000000
tok = jwt/sign-mldsa65 kp.sk { sub = 'alice', iss = 'veko.local', exp = now_s + 3600 }
ver = jwt/verify-mldsa65 tok kp.pk
_ = jwt/validate-claims ver.claims (jwt/ClaimOpts { issuer = 'veko.local' })
// OAuth 2.0 PKCE S256
pkce = oa/generate-pkce
5. Zero-FFI Database Stack (db/sqlite, db/kv, db/postgres, db/redis, db/sidecar)
Veko talks to embedded and networked databases—including genuine SQLite 3 files—with zero native C client libraries or FFI:
Zero-FFI SQLite 3 B-Tree Engine, Crash-Safe Journal, Indexes & JOINs (db/sqlite)
lib/db/sqlite.vk implements a 100% pure-Veko reader and writer for standard "SQLite format 3\0" 4096-byte slotted B-tree .sqlite / .db files across --vm, --wasm (.fs only — zero .ffi and zero .clocks!), and --native:
- Crash-Safe
'VKJRNL01'Hot Rollback Journal & Incremental Page Commits:sq/saveandCOMMITwrite pre-images of dirty 4096-byte pages to<db>-journalwith CRC-32 verification (os/fsync), patch only modified pages via positionedos/pwrite+os/fsync, and unlink the journal under<db>-lockadvisory coordination. If a power loss or crash interrupts a commit,sq/open(sq/recover-journal) automatically verifies and replays<db>-journalbefore opening. - Multi-Page
0x02/0x0aB-Tree Indexes & $O(\log N)$ Seeks: Writes genuine multi-level interior (0x02) and leaf (0x0a) index B-trees (plus overflow page chains for large payloads) and executes $O(\log N + K)$ binary-search equality and range scans (=,>,>=,<,<=,BETWEEN) viasq/seek-index-btreeandsq/seek-table-rowid. - Relational
INNER JOIN&LEFT JOIN(SQL & Homoiconicsq/q): Supports multi-table aliases, qualifiedu.colprojections/predicates/aggregates,INNER JOIN, and null-extendingLEFT JOINin bothsq/query-sqlandsq/q:
use [sq = db/sqlite]
users = sq/define-table 'users' (quote [
id i64 .pk
email str .unique
region str .index
score i64 = 0
])
orders = sq/define-table 'orders' (quote [
id i64 .pk
user_id i64 .index
cents i64 = 0
])
mut db = sq/open 'data/app.sqlite'
_ = sq/migrate mut db users
_ = sq/migrate mut db orders
uid = sq/insert mut db users { email = 'ada@veko-lang.org', region = 'ca-central-1', score = 98 }
_ = sq/insert mut db orders { user_id = uid, cents = 4900 }
// Homoiconic LEFT JOIN query with qualified projections
rows = sq/q db (quote [
select [u.email o.cents]
from users u
left-join orders o on [u.id == o.user_id]
where [u.score >= 90]
order-by [u.score .desc]
limit 10
])
_ = sq/close mut db
Files written by db/sqlite (sq/open, sq/save, sq/to-bytes) are genuine SQLite 3 binary databases directly readable by the standard sqlite3 CLI and DB Browser for SQLite, while enforcing Veko's .secret firewall on every SQL query and parameter.
Embedded Crash-Safe Transactional KV Store (db/kv)
Built directly on positioned os/{open,pread,pwrite,fsync,truncate,rename,close} with a CRC-32-verified WAL, automatic tail truncation on crash recovery, atomic batches, log compaction, sorted prefix scans, codec/vbin typed storage, and optional AES-256-GCM at-rest encryption (crypto/seal):
use [kv = db/kv]
mut store = kv/open 'data/app.vkkv'
_ = kv/put-val mut store 'node:1' { host = 'eu-west-1', active = true }
_ = kv/put-sealed mut store 'vault/token' enc_key32 (bytes/from-str 'secret-value')
_ = kv/compact mut store
keys = kv/scan-prefix store 'node:'
_ = kv/close mut store
PostgreSQL v3.0 TLS, Prepared Extended Queries & Connection Pool (db/postgres)
Pure-Veko PostgreSQL v3.0 protocol client and bounded connection pool (PgConfig, PgPool) supporting PostgreSQL SSLRequest ('S') upgrade to net/tls13, RFC 5802/7677 SCRAM-SHA-256, MD5, and CleartextPassword authentication, binary Extended Query $1, $2... Parse/Bind/Describe/Execute/Sync (query-params, exec-params, named prepare/query-prepared statement caching), savepoint-aware with-tx, and closure-free channel-backed PgPool (new-pool, acquire, release, with-conn with SELECT 1 health checks and auto-reconnect):
use [pg = db/postgres]
cfg = pg/PgConfig {
host = 'db.internal'
port = 5432
user = 'veko'
password = (os/getenv/or 'PG_PASS' [''])
database = 'appdb'
tls_mode = .require
}
pool = pg/new-pool cfg 8
rows = pg/with-conn pool fn [mut conn pg/PgConn] any [
pg/with-tx mut conn fn [mut tx pg/PgConn] any [
pg/query-params mut tx 'SELECT id, email FROM users WHERE region = $1 AND active = $2' ['ca-central-1' true]
]
]
_ = pg/close-pool pool
Redis RESP3 TLS Client, Transactions & Pool (db/redis) & Sidecar RPC (db/sidecar)
db/redis: Full RESP3/RESP2 encoder/decoder (supporting strings, blobs, integers, booleans, doubles, big numbers, verbatim strings, maps, sets, attributes, and push frames),RedisConfig(connectwith optional TLS 1.3 + ACLAUTH user pass+HELLO 3negotiation),MULTI/EXEC/DISCARDwith-txtransactions, pipelines, and channel-backedRedisPool(new-pool,with-connwithPINGliveness validation and auto-reconnect).db/sidecar: CRC-32-verified'VKSC'binarycodec/vbinRPC framing (encode-req,decode-req,encode-resp,decode-resp,call-exec) for integrating external database engines cleanly via.exec-gated subprocesses without in-process FFI.
6. Signed 'VKP1' Package Bundles (pkg/vkp, veko pkg, & trust-keys)
Veko packages multi-module libraries into single-file 'VKP1' binary archives secured by:
- Canonical path confinement (rejecting
.., leading/,\, and NUL bytes) and strict lexicographical entry sorting, - Per-module SHA-256 digests combined into a deterministic binary SHA-256 Merkle root,
- Cryptographic signatures using Ed25519, post-quantum ML-DSA-65, or hybrid dual signatures (both Ed25519 and ML-DSA-65 in the same bundle).
CLI Packaging & Verification (veko pkg)
# Pack a directory of .vk modules into a signed VKP1 bundle
veko pkg pack vendor/stats --name=veko-stats --version=1.0.0 --ed25519-seed=<64-hex> -o vendor/stats.vkp
# Inspect manifest, Merkle root, entries, and signer public keys
veko pkg inspect vendor/stats.vkp
# Verify against an explicit trust anchor
veko pkg verify --trust=ed25519:<64-hex-pubkey> vendor/stats.vkp
Installing from veko-lang.org or Decentralized HTTPS (veko pkg add & ~/.veko_modules)
Bare 'name@version' specs resolve from the official https://veko-lang.org/pkg/<name>/<version>.vkp registry (overrideable via VEKO_REGISTRY), while 'https://...' URLs fetch decentralized third-party bundles over pure-Veko TLS 1.3 into ~/.veko_modules and pin their SHA-256 + Merkle root in veko.lock:
veko pkg search rag
veko pkg info vec_rag
veko pkg add cloud_s3@1.0.0
veko pkg add openapi@1.0.0
veko pkg add ai_mcp@1.0.0
veko pkg add https://packages.example.org/veko/metrics-0.3.0.vkp
veko pkg verify-lock
Official veko-lang.org Ecosystem Packages (30 Signed .vkp Libraries)
Alongside the 95 embedded VKFS standard library modules, https://veko-lang.org/packages publishes 30 Ed25519-signed pure-Veko .vkp libraries across six production tiers, each bundling full API documentation (README.md), a self-contained runnable example (examples/demo.vk), and 1-click browser WebAssembly 3.0 Playground execution:
| Tier | Package (veko pkg add ...) |
Exported Modules | Summary |
|---|---|---|---|
| Tier 1 | cloud_s3@1.0.0 |
cloud_s3 |
AWS Signature V4 signing, presigned GET/PUT URLs, and S3 / R2 / MinIO object client. |
| Tier 1 | data_formats@1.0.0 |
data_formats, data_formats/yaml, data_formats/xml |
YAML 1.2 subset codec, XML/XHTML DOM & query helpers, RSS 2.0, and Atom 1.0 feeds. |
| Tier 1 | openapi@1.0.0 |
openapi, openapi/schema |
Homoiconic [ ... ] data validator, JSON Schema Draft 2020-12, OpenAPI 3.1, and HTML API Explorer. |
| Tier 1 | smtp_mail@1.0.0 |
smtp_mail |
Multipart MIME composer, Ed25519 DKIM signer/verifier, SMTP STARTTLS/TLS client, and Resend/Postmark JSON. |
| Tier 1 | webauthn@1.0.0 |
webauthn, webauthn/policy |
FIDO2 / WebAuthn Passkey verifier (CBOR COSE P-256 & Ed25519) + homoiconic RBAC/ABAC policy engine. |
| Tier 2 | grpc_proto@1.0.0 |
grpc_proto, grpc_proto/proto |
Protocol Buffers v3 wire codec (varint, zigzag, fixed32/64), homoiconic schema, and 5-byte gRPC framing. |
| Tier 2 | cluster_raft@1.0.0 |
cluster_raft, cluster_raft/swim |
Deterministic Raft leader election, replicated log & quorum commit + SWIM gossip failure detector. |
| Tier 2 | mq_streams@1.0.0 |
mq_streams, mq_streams/nats, mq_streams/kafka |
NATS Core/Headers wire protocol & wildcard subjects + Kafka RecordBatch v2 (CRC32C) & Produce/Fetch codecs. |
| Tier 2 | db_drivers@1.0.0 |
db_drivers, db_drivers/mysql, db_drivers/clickhouse |
MySQL v10 binary handshake, native & caching_sha2 auth, and ResultSet decoder + ClickHouse Zstd JSONEachRow. |
| Tier 2 | resilience@1.0.0 |
resilience |
Bounded ORO LRU+TTL cache, GCRA rate limiter, 3-state circuit breaker, backoff, and channel singleflight. |
| Tier 3 | ai_mcp@1.0.0 |
ai_mcp |
JSON-RPC 2.0 Model Context Protocol (2025-03-26) server & client with homoiconic tool schemas, stdio, and HTTP. |
| Tier 3 | ai_llm@1.0.0 |
ai_llm |
Unified multi-provider chat, tool-calling, structured output, and SSE delta parser (Gemini, Anthropic, OpenAI, Ollama). |
| Tier 3 | vec_rag@1.0.0 |
vec_rag, vec_rag/bm25, vec_rag/chunker |
Embedded HNSW vector index + int8 quantization, stemmed BM25 full-text search, RRF hybrid RAG, and SQLite persistence. |
| Tier 3 | dataframe_parquet@1.0.0 |
dataframe_parquet, dataframe_parquet/arrow |
Typed columnar DataFrames, homoiconic filter/join/group-agg pipelines, Arrow IPC, and Zstd columnar zone-map codec. |
| Tier 4 | payments_ledger@1.0.0 |
payments_ledger, payments_ledger/stripe |
Minor-unit Money math, penny-exact allocation, transactional SQLite double-entry ledger, and .secret Stripe/LemonSqueezy SDK. |
| Tier 4 | graphql@1.0.0 |
graphql, graphql/parser |
Zero-codegen homoiconic GraphQL schema, query/fragment parser, batching Dataloader, and HTML5 GraphiQL Explorer. |
| Tier 4 | browser_cdp@1.0.0 |
browser_cdp |
Chrome DevTools Protocol (CDP) JSON-RPC session multiplexing, DOM/Page/Network automation, and net/websocket E2E runner. |
| Tier 4 | ldap_saml@1.0.0 |
ldap_saml, ldap_saml/scim |
Enterprise SAML 2.0 SP AuthnRequest & signed Assertion verifier, OIDC JWKS matcher, and SCIM 2.0 /Users & /Groups sync. |
| Tier 5 | oci_k8s@1.0.0 |
oci_k8s, oci_k8s/k8s |
Daemonless ko-style distroless OCI image builder & registry v2 pusher plus typed Kubernetes manifests & WATCH client. |
| Tier 5 | noise_tunnel@1.0.0 |
noise_tunnel, noise_tunnel/socks5 |
Noise Protocol (NN & IKpsk2 X25519+ChaChaPoly) encrypted multiplexed tunnels and RFC 1928/1929 SOCKS5 proxy codec. |
| Tier 5 | iac_fleet@1.0.0 |
iac_fleet |
Homoiconic quote [...] Infrastructure-as-Code resource DAG, topological plan diffing, and .secret-redacted provisioning. |
| Tier 5 | wasm_plugin_sdk@1.0.0 |
wasm_plugin_sdk |
Multi-tenant Wasm 3.0 host-guest plugin ABI (VKPW), fuel/memory caps, host-call allowlists, and audit trail. |
| Tier 6 | crdt_sync@1.0.0 |
crdt_sync |
Hybrid Logical Clocks (HLC), PNCounter, LWW-Map, OR-Set, RGA collaborative text CRDT, and room presence sync. |
| Tier 6 | iot_mqtt@1.0.0 |
iot_mqtt, iot_mqtt/modbus, iot_mqtt/mdns |
MQTT 3.1.1/5.0 wire codec & embeddable broker, industrial Modbus TCP registers, and mDNS/DNS-SD .local discovery. |
| Tier 6 | web_live@1.0.0 |
web_live |
Homoiconic HTML virtual-DOM differ, keyed patch ops, SSE morphing frames, and typed HTMX helpers. |
| Tier 6 | jobs_cron@1.0.0 |
jobs_cron, jobs_cron/cron |
5-field cron parser & next-tick calculator + crash-safe Zero-FFI db/sqlite persistent job queue. |
| Tier 6 | doc_media@1.0.0 |
doc_media, doc_media/markdown, doc_media/pdf, doc_media/img, doc_media/ssh |
GFM Markdown-to-HTML, zero-dep PDF 1.4 generator, RGBA32 image transforms, and OpenSSH Ed25519 & SSHSIG. |
| Tier 6 | http_router@1.2.0 |
http_router |
Composable prefix-grouped web/App routers, CORS middleware, sliding-window rate limiters, and request IDs. |
| Tier 6 | veko_ui_kit@1.0.0 |
veko_ui_kit |
Accessible Light-First HTML5 KPI cards, data tables, status pills, alerts, breadcrumbs, tabs, and modals. |
| Tier 6 | sqlite_orm_ext@1.0.0 |
sqlite_orm_ext |
Base64URL cursor pagination, schema migration versions, audit logs, JSON/CSV export, and DDL diffing. |
Consuming Verified .vkp Dependencies in veko.vk
Declare .vkp bundle dependencies alongside trust-keys in veko.vk. The compiler verifies the SHA-256 Merkle root and cryptographic signatures against trust-keys in memory before loading any module AST — unsigned, tampered, or untrusted bundles are rejected automatically:
{
name = 'my-app'
root = 'src'
allow-caps = [.fs .net]
trust-keys = [
'ed25519:a1b2c3...'
'mldsa65:d4e5f6...'
]
deps = {
stats = 'vendor/stats.vkp'
}
}
7. Everyday Batteries (datetime, utf8, fs, slog, archive/*, codec/toml, net/ip, semver, diff, retry)
All everyday utility libraries follow Veko's consistent Subject-Verb-Object (SVO) convention (parse/format, encode/decode, pack/unpack, ? predicates, /or recovery):
| Module | Capabilities | Key APIs |
|---|---|---|
datetime |
Pure (.clocks for now-utc) |
DateTime, now-utc, from-unix, to-unix, parse-rfc3339, format-rfc3339, format-http, add-days, with-offset, weekday, leap-year? |
utf8 |
Zero | valid?, decode-rune, encode-rune, rune-count, runes, from-runes, multi-byte-safe rune-slice |
fs |
.fs |
exists?, dir?, file?, mkdir-all, remove-all, walk-dir, glob-dir, copy-file, write-atomic, RAII with-temp-dir |
slog |
.clocks/.fs |
Logger, new-json, new-kv, with-level, with-fields, format-line, emit, emit-stream, debug/info/warn/error |
archive/tar |
Zero | POSIX USTAR TarEntry, pack, unpack, pack-gz, unpack-gz (path-confined + checksum verified) |
archive/zip |
Zero | PKZIP ZipEntry, pack, unpack (STORE + DEFLATE via compress/deflate + CRC-32) |
codec/toml |
Zero | TOML v1.0 decode & encode ([tables], nested tables, arrays, inline tables, comments) |
net/ip |
Zero | IPv4 & IPv6 parse, canonical RFC 5952 format, parse-cidr, contains?, v4?, v6?, loopback?, private? |
semver |
Zero | SemVer 2.0.0 parse, format, compare, bump-{major,minor,patch}, satisfies? (^, ~, >=, <, comma AND) |
diff |
Zero | LCS line diff diff-lines, equal?, format-unified (--- a / +++ b) |
retry |
.clocks |
RetryOpts, backoff-delay, run (exponential backoff + jitter), token-bucket RateLimiter (limiter-new, allow?) |
8. Runnable Examples & Doctests
Explore and verify every library in this guide across all three execution tracks:
# 1. Connected I/O streams, UUID v7, DNS, Hybrid PQC TLS 1.3 (X25519MLKEM768) & HTTP/2
veko run --allow-net --allow-listen --allow-private-net examples/21_io_streams_dns_and_pqc_tls.vk
# 2. Web micro-framework, HS256/EdDSA/ML-DSA-65 JWT, OAuth2 PKCE & RFC 6455 WebSockets
veko run --allow-net --allow-listen --allow-private-net examples/22_web_server_websocket_and_jwt.vk
# 3. Embedded crash-safe KV store, PostgreSQL SCRAM-SHA-256, Redis RESP3 & Sidecar RPC
veko run --allow-net --allow-listen --allow-private-net examples/23_zero_ffi_databases_kv_pg_redis.vk
# 4. Signed VKP1 package bundles (Merkle tree + Hybrid Ed25519 & ML-DSA-65 + tamper rejection)
veko run examples/24_signed_vkp_package_bundles.vk
# 5. Everyday batteries: datetime, utf8, fs, slog, tar.gz/zip, toml, net/ip, semver, totp, diff & retry
veko run examples/25_batteries_datetime_fs_archives_and_toml.vk
# 6. Pure-Veko HTML5 component DSL (`html`), safe templates (`template`), `web/page` & unified `net/client`
veko run --allow-net --allow-listen --allow-private-net examples/26_pure_vk_html_components_and_http_client.vk
# Run all embedded doctests across the networking, web, database, and package libraries
veko doc --test io/fs io/net io/open net/dns net/websocket net/http2 net/client net/ip auth/jwt auth/oauth2 auth/totp web html template db/kv db/redis db/sidecar pkg/vkp datetime utf8 fs slog archive/tar archive/zip codec/toml semver diff retry
Part VIII: Async I/O & Readiness Reactor Guide
Veko delivers high-concurrency, non-blocking network I/O without colored async/await functions, garbage collection, or external C runtimes. Instead of transforming every function into a hidden heap state machine, Veko pairs its single-owner ORO memory model and shared-nothing spawn workers with an OS-native Readiness Reactor (lib/reactor.vk) and non-blocking socket primitives (lib/io/net.vk, lib/web.vk, lib/net/client.vk, lib/net/websocket.vk).
1. Architecture & OS Backends
OS-Native Readiness Reactor, Timer Wheel & Multiplexed HTTP Engine
Single-threaded readiness multiplexing over epoll, kqueue, IOCP+WSAPoll, and WASI net-poll without async/await coloring.
Every reactor operation is gated behind the .net capability (allow-caps = [.net] in veko.vk) and compiles to the native kernel readiness primitive of each target:
| Target Platform | Underlying Kernel / Sandbox Mechanism | Cross-Thread Wakeup (reactor/wake-handle) |
|---|---|---|
Linux x86_64 (--target=linux-x64) |
epoll_create1 / epoll_ctl / epoll_pwait (zero-libc syscalls) |
eventfd2 (EFD_NONBLOCK | EFD_CLOEXEC) |
Linux arm64 (--target=linux-arm64) |
epoll_create1 / epoll_ctl / epoll_pwait (zero-libc syscalls) |
eventfd2 (EFD_NONBLOCK | EFD_CLOEXEC) |
macOS Apple Silicon (--target=macos-arm64) |
kqueue / kevent (EVFILT_READ, EVFILT_WRITE) |
EVFILT_USER (NOTE_TRIGGER) |
Windows x64 & ARM64 (--target=win-x64 / --target=win-arm64) |
Win32 IOCP (CreateIoCompletionPort / GetQueuedCompletionStatus) + WSAPoll |
PostQueuedCompletionStatus + loopback UDP wake |
64-bit VKO VM (--vm) |
Delegates directly to host OS native reactor | Host OS native wakeup |
Wasm 3.0 Sandbox (--wasm) |
wasi:sockets@0.3.0 net-poll + wasi:clocks@0.3.0 |
In-sandbox wake flag |
2. Core Low-Level Builtins (net/poll-* & net/try-*)
All 11 non-blocking reactor builtins require the .net capability and preserve the .secret firewall (net/try-write rejects .secret buffers both statically and at runtime):
| Builtin | Arity | Return | Description |
|---|---|---|---|
net/poll-new |
0 |
i64 |
Allocates a new OS readiness poller handle. |
net/poll-ctl |
5 |
enum |
(poller, op, fd, events, token) — op: 1=ADD, 2=MOD, 3=DEL; events: 1=READ, 2=WRITE. |
net/poll-wait |
2 |
block |
(poller, timeout_dur) — returns a block of [token mask] pairs (1=READ, 2=WRITE, 4=ERR, 8=HUP). |
net/poll-wake |
1 |
enum |
(poller) — thread-safe wakeup of a thread blocked in net/poll-wait. |
net/poll-close |
1 |
enum |
(poller) — closes OS poller handles and releases internal slabs (idempotent). |
net/set-nonblock |
2 |
enum |
(sock, enabled bool) — toggles O_NONBLOCK / FIONBIO. |
net/connect-tcp/nonblock |
2 |
i64 |
(host, port) — initiates non-blocking TCP connect (EINPROGRESS / WSAEWOULDBLOCK succeeds). |
net/sock-error |
1 |
i64 |
(sock) — queries SO_ERROR via getsockopt (0 = connected/healthy). |
net/try-accept |
1 |
i64 |
(listener) — returns client socket >= 0, -1 if would-block, or err. |
net/try-read-into |
3 |
i64 |
(sock, mut buf, max_n) — appends up to max_n bytes into mut buf; returns > 0 bytes read, 0 on EOF, -1 if would-block, or err. |
net/try-write |
2 |
i64 |
(sock, data) — writes without blocking; returns >= 0 bytes sent, -1 if would-block, or err (blocks .secret). |
3. Using lib/reactor.vk (Event Loop, Timers & Cross-Thread Wakeup)
lib/reactor.vk provides both pull-mode polling (idiomatic when mutating local single-owner connection tables with zero closure capture limits) and callback-mode dispatching (reactor/register-cb, reactor/after-cb, reactor/tick, reactor/run).
Timers & Cross-Thread spawn Wakeup
Because spawn workers are shared-nothing and cannot capture mut r, call reactor/waker r to extract a copyable i64 waker handle and pass it to any worker thread:
use [reactor]
mut r = reactor/new
defer [ _ = reactor/close mut r ]
w = reactor/waker r
tid = reactor/after mut r 25ms
worker = spawn [
time/sleep 5ms
_ = reactor/wake-handle w
.done
]
// Wakes early (~5ms) instead of sleeping for 2s
evs = reactor/poll mut r 2s
_ = task/await worker
// Poll until timer #tid fires
mut fired = false
while not fired [
_ = reactor/poll mut r 25ms
due = reactor/due-timers mut r
mut i = 0
while i < (len due) [
if due[i] == tid [ fired = true ]
i = i + 1
]
]
Pull-Mode Readiness Helpers
reactor/EV-READ(1),reactor/EV-WRITE(2),reactor/EV-ERR(4),reactor/EV-HUP(8),reactor/EV-RW(3)reactor/readable? ev,reactor/writable? ev,reactor/errored? ev,reactor/closed? evreactor/register mut r fd events->tokenreactor/modify mut r token events->.okreactor/unregister mut r token->.okreactor/after mut r delay/reactor/every mut r interval/reactor/cancel-timer mut r tid
4. Non-Blocking HTTP/1.1 Server (web/serve-reactor & web/serve-async)
lib/web.vk includes a single-threaded, reactor-driven HTTP/1.1 server that multiplexes many concurrent connections over one OS thread. Slow or stalled clients (such as a peer pausing mid-header) never block other requests, and per-connection idle timeouts plus header/body size limits protect server memory automatically:
use [web]
mut app = web/new-app
web/use-security-headers mut app
web/get mut app '/health' fn [req web/Request] web/Response [
web/json-resp 200 { status = 'ok', path = req.path }
]
ln = net/listen-tcp .ip '127.0.0.1:8080'
opts = web/AsyncServerOpts {
max_requests = 0 // 0 = serve indefinitely
read_timeout = 10s
tick_timeout = 25ms
max_header_bytes = 65536
max_body_bytes = 4194304
}
_ = web/serve-reactor ln app opts
For quick tests or bounded batch runs, use the convenience wrapper web/serve-async ln app 100.
5. Concurrent Non-Blocking HTTP/1.1 Client (net/client/request-batch & get-many)
lib/net/client.vk can fan out dozens of HTTP/1.1 requests simultaneously on a single reactor thread with per-request deadlines and transparent gzip/deflate decompression:
use [hc = net/client]
reqs = [
(hc/AsyncRequest { method = 'GET', url = 'http://127.0.0.1:8080/items/1', timeout = 5s })
(hc/AsyncRequest { method = 'GET', url = 'http://127.0.0.1:8080/items/2', timeout = 5s })
(hc/AsyncRequest { method = 'POST', url = 'http://127.0.0.1:8080/echo', body = (bytes/from-str 'ping'), timeout = 5s })
]
resps = hc/request-batch reqs
// resps[i] is either an `hc/HttpResponse` or `err` in matching input order
For parallel GET fan-out with shared options, use hc/get-many ['http://...' 'http://...'] (hc/RequestOpts { timeout = 5s }).
6. Non-Blocking Sockets (lib/io/net.vk) & Incremental WebSockets (lib/net/websocket.vk)
lib/io/net.vk:inet/listen-nonblock addr— binds TCP listener and enables non-blocking modeinet/dial-tcp-nonblock host port— starts non-blocking TCP connectinet/set-nonblock sock enabled/inet/sock-error sockinet/try-accept ln/inet/try-read-into sock mut buf max_n/inet/try-write sock data/inet/try-write-from sock data offset
lib/net/websocket.vk:ws/try-decode-frame raw— incrementally parses RFC 6455 frames from a non-blocking receive buffer, returningFrameTry { complete = false, ... }until a full frame has arrived.
7. Running the Full End-to-End Example
See examples/29_async_reactor_http_server_and_client.vk for a complete demonstration covering cross-thread wakeups, timers, slow-client isolation, 4-way concurrent HTTP batching, secret firewall checks, and incremental WebSocket framing:
# Run on 64-bit VKO VM
veko run --vm --allow-net --allow-listen --allow-private-net examples/29_async_reactor_http_server_and_client.vk
# Compile & run natively (Win64 IOCP+WSAPoll or Linux epoll+eventfd2)
veko compile --native examples/29_async_reactor_http_server_and_client.vk -o dist/ex29.exe
./dist/ex29.exe
# Cross-compile for Windows ARM64, Linux x86_64, Linux arm64, or macOS Apple Silicon
veko compile --native --target=win-arm64 examples/29_async_reactor_http_server_and_client.vk -o dist/ex29-win-arm64.exe
veko compile --native --target=linux-x64 examples/29_async_reactor_http_server_and_client.vk -o dist/ex29-linux-x64
veko compile --native --target=linux-arm64 examples/29_async_reactor_http_server_and_client.vk -o dist/ex29-linux-arm64
veko compile --native --target=macos-arm64 examples/29_async_reactor_http_server_and_client.vk -o dist/ex29-macos-arm64
Related Guides
- Network, Web, TLS 1.3 & Databases Guide
- Operations & Use Cases
- Performance & Cross-Compilation Guide
- Configuration & CLI Reference
Part IX: Durable Objects & Durable Workflows Guide
Veko 1.0 includes a zero-dependency Durable Objects (lib/durable/object.vk) and Durable Workflows (lib/durable/workflow.vk) library layered directly over lib/db/kv.vk's CRC-32-verified Write-Ahead Log (WAL). Every state transition, alarm, inbox message, step checkpoint, signal, and saga compensation is committed atomically in db/kv batches and survives process restarts and crashes cleanly.
1. Architecture Over lib/db/kv.vk
Crash-Safe Durable Objects & Replay-Safe Workflows over db/kv
Single-writer transactional actors, memoized step checkpoints, external signals, and LIFO saga compensations.
Both abstractions share one single embedded db/kv file (or separate stores per service) using clean, lexicographically sorted key prefixes:
| Key Prefix | Owner | Stored Payload (codec/vbin) |
|---|---|---|
do/<ns>/<id>/meta |
durable/object |
Version counter, timestamps, inbox sequence counter, active alarm deadline |
do/<ns>/<id>/kv/<field> |
durable/object |
Individual durable state fields |
do/<ns>/<id>/inbox/<seq> |
durable/object |
Monotonic FIFO mailbox messages (with attempt counters & visibility deadlines) |
do_alarm/<ns>/<id> |
durable/object |
Indexed durable alarm schedule for O(k) poll-due-alarms |
do_dlq/<ns>/<id>/<seq> |
durable/object |
Poison-message Dead-Letter Queue (list-dead-letters) |
wf/<id>/meta |
durable/workflow |
Run status (.running, .waiting, .completed, .failed, .compensated), wake deadlines, worker lease |
wf/<id>/step/<name> |
durable/workflow |
Memoized step result, retry attempt count, backoff deadline, or durable timer |
wf/<id>/event/<name> |
durable/workflow |
External signal payload delivered via send-event |
wf/<id>/comp/<seq> |
durable/workflow |
LIFO saga compensation journal entries |
wf/<id>/log/<seq> |
durable/workflow |
Chronological execution audit trail |
wf_dlq/<id> |
durable/workflow |
Dead-Letter Queue entry for exhausted workflows (requeue-dead-letter) |
2. Durable Objects (lib/durable/object.vk)
A Durable Object is a named, single-writer, versioned stateful actor ((namespace, id)). All mutations commit atomically alongside the object's version counter.
Transactional Actor Turns (mutate) with Automatic Rollback
use [d = durable, dobj = durable/object]
mut db = d/open-store 'state.vkkv'
mut acct = d/object mut db 'account' 'acct-001'
_ = dobj/put-fields mut db mut acct { owner = 'Alice', balance = 500 }
// Atomic turn: succeeds and increments acct.version in one WAL batch
bal = dobj/mutate mut db mut acct fn [st] [
cur = as-i64 (map/get/or st 'balance' [ 0 ])
if cur < 120 [ return (err 'insufficient funds') ]
mut next = st
map/set mut next 'balance' (cur - 120)
{ state = next, result = (cur - 120) }
]
If the handler returns err, zero keys are written and acct.version stays untouched.
Durable Alarms, Batch Enqueue & Transactional process-inbox with DLQ
Alarms and inbox messages are persisted in the WAL so they survive restarts. Use enqueue-batch for single-fsync multi-message writes, mutate-cas for optimistic compare-and-swap version checks across concurrent handles, and process-inbox (InboxOpts) to commit handler state updates and message deletion in one atomic WAL batch—automatically backing off failed messages and routing poison messages exceeding max_attempts into do_dlq/<ns>/<id>/<seq>:
use [d = durable, dobj = durable/object]
_ = dobj/set-alarm mut db mut acct 30s 'billing-reconcile'
_ = dobj/enqueue-batch mut db mut acct [
{ kind = 'credit', payload = 250 }
{ kind = 'debit', payload = 75 }
]
stats = dobj/process-inbox mut db mut acct (dobj/InboxOpts {
max_messages = 32
max_attempts = 3
base_backoff = 100ms
}) fn [st msg] [
bal0 = as-i64 (map/get/or st 'balance' [ 0 ])
delta = if msg.kind == 'credit' [ as-i64 msg.payload ] else [ 0 - (as-i64 msg.payload) ]
if (bal0 + delta) < 0 [ return (err 'overdraft') ]
mut next = st
map/set mut next 'balance' (bal0 + delta)
next
]
due = dobj/poll-due-alarms mut db 'account'
dlqs = dobj/list-dead-letters db acct
3. Durable Workflows (lib/durable/workflow.vk)
A Durable Workflow executes multi-step business logic with exact-once step memoization: if the process crashes halfway through a workflow and replays from the top, already-completed steps return their persisted checkpoints from db/kv without re-executing side effects.
Memoized Steps, Retries, Signals, Timers & LIFO Sagas
use [d = durable, wf = durable/workflow]
mut db = d/open-store 'workflows.vkkv'
mut run = d/workflow mut db 'ord-77' 'fulfill-order' { sku = 'VEKO-PRO', qty = 2 }
// 1. Memoized step: runs once, replays from db/kv on restart
res_id = wf/step mut db mut run 'reserve-inventory' fn [] [
'res-901'
]
// 2. Durable retry with backoff & persisted attempt count
quote = wf/step-with-retry mut db mut run 'fetch-quote' 3 100ms fn [attempt] [
if attempt < 2 [ return (err 'transient carrier timeout') ]
{ carrier = 'fastpost', cents = 1299 }
]
// 3. Suspend waiting for an external webhook signal
sig = wf/wait-event mut db mut run 'payment-confirmed'
if not sig.ready [
// Workflow is durably parked in .waiting until `wf/send-event` arrives
return .ok
]
// 4. Durable timer that survives restarts
if not (wf/sleep-until mut db mut run 'cooling-window' 5s) [
return .ok
]
_ = wf/complete mut db mut run { reservation = res_id, receipt = sig.payload.receipt }
LIFO Saga Compensations, Batch Steps, Worker Leases & Workflow DLQ
Register compensating actions as forward steps succeed. If a downstream step fails permanently, call wf/run-compensations to unwind in strict reverse (LIFO) order:
_ = wf/record-compensation mut db mut run 'release-inventory' res_id
_ = wf/record-compensation mut db mut run 'void-payment' auth_id
// On unrecoverable failure:
n = wf/run-compensations mut db mut run fn [comp_name data] [
println (str/join ['undo ' comp_name ': ' (mold data)] '')
.ok
]
For high-throughput distributed workers:
wf/step-policy& Dead-Letter Queue (wf_dlq/*): Configurewf/RetryPolicy { max_attempts, base_backoff, max_backoff, backoff_factor, dead_letter = true }so non-parked steps persist exponential backoff deadlines (status = .waiting, zero thread blocking!) and move exhausted runs towf_dlq/<id>. Inspect viawf/list-dead-letters dband replay after fixing an upstream outage viawf/requeue-dead-letter mut db 'ord-77'.wf/step-batch: Executes and checkpoints multiple deterministic sub-steps in a single WALfsynccommit (wf/step-batch mut db mut run [['validate' fn [] [...]] ['enrich' fn [] [...]]]).wf/wait-event-timeout: Parks a workflow awaiting an external webhook signal up to a durable deadline (wf/wait-event-timeout mut db mut run 'approval' 24h), returning{ ready = false, timed_out = true }if the deadline elapses first.- Distributed Worker Leases (
poll-runnable&claim-run): Multiple worker processes poll ready workflows whose sleep/retry timers or signals have matured (wf/poll-runnable db 16) and acquire time-bounded leases (wf/claim-run mut db run_id 'worker-01' 30s) before resuming execution.
Run the end-to-end crash-and-replay demonstration in examples/32_durable_objects_and_workflows.vk:
veko run examples/32_durable_objects_and_workflows.vk
veko run --native examples/32_durable_objects_and_workflows.vk
Part X: Terminal UI, Native Desktop UI Toolkit, PNG Graphics, and Opt-In FFI Guide
Veko ships a complete, capability-isolated stack for terminal dashboards (lib/tui.vk), zero-dependency 2D software graphics, RFC 2083 PNG encoding/decoding (lib/image/png.vk), mixed-case proportional typography (lib/ui/font.vk), 1D/2D flex & grid layout (lib/ui/layout.vk), 33 immediate-mode desktop & studio widgets (lib/ui/widgets.vk), native window surfaces across Win32, zero-libc Linux Wayland (wl_shm) & X11, macOS arm64 (AppKit / CoreGraphics), and Wasm <canvas> with keyboard focus traversal, OS clipboard & Hi-DPI scaling (lib/ui.vk, lib/ui/wayland.vk, lib/ui/x11.vk), and opt-in foreign library interop (lib/ffi.vk honoring VEKO_LIB + veko bindgen).
1. Capability Model & Zero-Bloat Guarantees
Capability-Isolated Terminal UI, RGBA32 Canvas, .ui Window & Opt-In .ffi
Four clean layers keeping CLI binaries tiny while enabling rich TrueColor TUIs, 60 FPS 2D GUIs, and C/Rust interop.
Every layer in Veko's UI and FFI stack follows least-privilege capability isolation:
| Layer | Modules | Required Capability | Native Binary Footprint | Wasm 3.0 (--wasm) |
|---|---|---|---|---|
| Terminal UI (TUI) | tui |
None | Pure ANSI/VT100; zero GUI DLLs | Supported |
| 2D Canvas, Font, Layout, Wayland/X11 Framing, PNG & 33 Studio Widgets | ui/canvas, ui/font, ui/layout, ui/wayland, ui/x11, ui/widgets, image/png |
None (allow-caps = []) |
Pure Veko RGBA32 rasterizer, Wayland & X11 wire codecs + zlib PNG; zero GUI DLLs | Supported |
| Native Window, Keyboard/Mouse Events, OS Clipboard & Hi-DPI Surface | ui (ui/open, ui/present, ui/poll-events, ui/clipboard-get, ui/clipboard-get/secret, ui/clipboard-set, ui/dpi-scale, ui/close) |
.ui (allow-caps = [.ui]) |
Win32 Per-Monitor V2 Hi-DPI (--gui sets PE Subsystem = 2); Linux zero-libc Wayland (wl_shm + memfd_create + SCM_RIGHTS) cascading to X11 over AF_UNIX; macOS arm64 AppKit/CoreGraphics Retina NSWindow (linked only when .ui is active); headless fallback via VEKO_HEADLESS=1 |
Supported (shared linear-memory <canvas> + event ring, 0 leaked slabs) |
| Opt-In Foreign Libraries | ffi (ffi/open, ffi/sym, ffi/call, ffi/close) + veko bindgen |
.ffi (denied by default; requires --allow-ffi, -C ffi, or allow-caps = [.ffi]) |
Resolves search directories from VEKO_LIB; Win64 kernel32.dll; Linux x86_64 opt-in dynamic ELF64 (libc.so.6) only when .ffi is active; macOS arm64 libSystem |
Strictly forbidden (zero-trust sandbox) |
2. Terminal UI (lib/tui.vk)
lib/tui.vk provides a double-buffered ANSI/VT100 screen grid with 24-bit TrueColor RGB cells, style bitmasks, boxes, progress bars, sparklines, tables, tui/parse-key input decoding, and a diffing frame encoder (tui/render-diff) that only transmits modified cells:
use [tui]
mut scr = tui/new-screen 60 12
tui/clear mut scr tui/color-white tui/color-surface
tui/draw-box mut scr 0 0 60 12 'Node Monitor' .rounded tui/color-cyan tui/color-surface
tui/draw-progress mut scr 2 3 30 75 tui/color-emerald tui/color-slate tui/color-surface
frame_ansi = tui/render-diff mut scr
3. 2D Canvas, Typography, Flex/Grid Layout & Lossless PNG (ui/*, image/png)
ui/canvas: Porter-DuffSRC_OVERRGBA32 rasterizer withset-clip/reset-clipscissor rectangles,fill-rounded-rect,stroke-rounded-rect,draw-line-smooth,fill-circle,stroke-circle,encode-bmp, andencode-ppm.ui/font: Crisp mixed-case proportional & monospace typography (A-Z,a-zwith true ascenders/descenders,0-9, symbols, and bullet masks) across body (size = 1), heading (size = 2), and display (size = 3) scales, plusdraw-truncatedellipsis clipping.ui/layout: 1D/2D constraint solver (px,flex,flex-row,flex-col,grid,split-h,split-v,ClipStack) usable standalone or viaui/widgets.image/png: Pure-Veko RFC 2083 RGBA32 PNG encoder and decoder (png/encode,png/encode-rgba,png/decode,png/decode-rgba) using adaptive per-scanline filtering andcompress/deflate.ui/x11: Pure-Veko X11 Release 11 wire-protocol codec (build-setup,parse-setup,plan-bands,build-put-image-band,decode-event) backing Veko's zero-libcLinux desktop window surface (AF_UNIX/tmp/.X11-unix/X<n>,.XauthorityMIT-MAGIC-COOKIE-1, and chunked scanline-bandPutImage<= 128 KB).
4. The 33-Widget Immediate-Mode Desktop & Studio Toolkit (lib/ui/widgets.vk)
lib/ui/widgets.vk renders studio-grade Light-Mode and Dark-Mode desktop interfaces directly into a cv/Canvas with zero GC pauses, zero host capabilities (allow-caps = []), and zero per-frame pixel buffer clones (demos/widget_gallery):
Keyboard Focus Ring, OS Clipboard, .secret Hygiene & Hi-DPI Scaling
- Full Keyboard Navigation & Focus Ring (
begin-frame/end-frame): Every interactive widget registers in a deterministic per-frame focus ring.TabandShift+Tabcyclefocus_idwith crisp theme accent outlines, whileSpace/Enteractivate buttons/checkboxes/toggles, arrow keys adjust sliders/radios/dropdowns/tabs/lists/trees, andEscapedismisses modals and palettes.lib/ui.vkexposesEV-KEY-DOWN,EV-KEY-UP,MOD-SHIFT/CTRL/ALT/SUPER, andKEY-F1..F12/ navigation constants across Win32, Wayland, X11, AppKit, and Wasm<canvas>. - OS Clipboard &
.secretOutbound Firewall:text-input,text-area, andcode-editorsupport keyboard selection (Shift+Arrows/Home/End) and system clipboard shortcuts (Ctrl+A,Ctrl+C,Ctrl+X,Ctrl+V).ui/clipboard-setrejects.secretvalues statically and at runtime, whileui/clipboard-get/secretreads pasted secrets directly into zeroized-on-drop.secretmemory. - Per-Monitor V2 Hi-DPI & Wasm
<canvas>:ui/dpi-scalequeries the active window's percentage scale factor (100,125,150,200) across Win32 Per-Monitor V2 (GetDpiForWindow), Linux Wayland/X11, macOS Retina, and browserdevicePixelRatio.
Studio IDE Widgets (code-editor, command-palette, file-picker, split-pane-state)
use [fs, cv = ui/canvas, w = ui/widgets]
mut st = w/new-state
mut ed = w/new-editor 'pub greet = fn [who str] str [\n `Hello, {who}!`\n]'
mut pal = w/new-palette
th = w/light-theme
mut c = cv/new-canvas 800 480
w/begin-frame mut st
// Multi-line Veko-highlighted code editor with line numbers, selection, clipboard & 64-step Ctrl+Z / Ctrl+Y undo/redo
_ = w/code-editor mut c mut st 'main-editor' (w/Rect { x = 16, y = 16, w = 768, h = 360 }) mut ed th '' ''
// Fuzzy command palette overlay (`Ctrl+P` / `Ctrl+K`)
cmd_id = w/command-palette mut c mut st 'studio-pal' (w/Rect { x = 0, y = 0, w = 800, h = 480 }) mut pal [
w/CommandItem { id = 'run', label = 'Run Active Buffer', shortcut = 'F5' }
w/CommandItem { id = 'check', label = 'Strict Type Check', shortcut = 'Ctrl+Shift+B' }
] th
w/end-frame mut st
To browse workspace files without adding .fs capabilities to ui/widgets, pair fs/list-entries dir (in lib/fs.vk) with the pure w/file-picker modal (w/FilePickerState, w/FileEntry), and resize multi-pane layouts interactively with w/split-pane-state.
Complete Widget Catalog
- Surfaces & KPI Cards:
panel,panel-body,label,heading,button(with/primary),icon-button,badge,stat-card. - Forms &
.secretInputs:text-input(with/secretbullet mask),secret-input(operates directly onmut secret byteswithoutstrconversion),text-area(with line-number gutter),checkbox,toggle-switch,radio-group,slider,progress-bar(with/label),dropdown,chip-group. - Navigation, Tables & Trees:
tabs,begin-scroll/end-scroll(with mouse wheelEV-WHEEL& scrollbar),list-view,select-list,data-table(zebra striping & auto-pill status cells),tree-view(disclosure triangles & badges),split-pane,split-pane-state(interactive mouse drag). - Studio IDE & Overlays:
code-editor(EditorState, Veko syntax highlighting,Ctrl+Z/Ctrl+Yundo/redo, auto-indent),command-palette(PaletteState, fuzzy search + shortcuts),file-picker(FilePickerState, breadcrumbs + extension filter),menu-bar,context-menu,modal,toast,tooltip. - Charts & Telemetry:
sparkline,bar-chart,line-chart(multi-series anti-aliased curves + legend).
Running the Desktop Showcases
# Run deterministic cross-runtime verification or export Light-Mode PNGs
veko demos/widget_gallery
veko demos/widget_gallery -- --export-dir docs/screenshots
# Launch live interactive Win32 desktop windows (EV-KEY, EV-TEXT, EV-WHEEL, EV-RESIZE, BTN-RIGHT)
veko demos/widget_gallery -- --live
veko demos/canvas_workbench -- --live
5. Opt-In Foreign Library Boundary (lib/ffi.vk) & veko bindgen
Veko's .ffi capability calls native shared libraries (.dll, .so, .dylib) via zero-W^X static AOT C-ABI trampolines while keeping .ffi denied by default, permanently blocked on --wasm, and walled off from .secret data.
Generating Wrapper Modules Automatically (veko bindgen)
Instead of hand-writing symbol lookups and struct offsets, point veko bindgen at a C header file to generate #define constants, Veko struct definitions, little-endian pack-* helpers, and typed ffi/call-c wrappers:
veko bindgen path/to/library_api_header -l sqlite3 -o src/sqlite_ffi.vk
veko check --strict-types -C ffi src/sqlite_ffi.vk
Manual Foreign Calls & C-Struct Packing
use [ffi]
mut buf = bytes/with-cap 32
ffi/pack-i32 mut buf -42
ffi/pack-u32 mut buf 0x12345678
ffi/pad-align mut buf 8
ffi/pack-i64 mut buf 1735689600000
ffi/pack-cstr mut buf 'veko-ffi'
is_win = (os/getenv/or 'OS' ['']) == 'Windows_NT'
lib = ffi/open-lib (if is_win [ 'kernel32.dll' ] else [ 'libc.so.6' ])
pid_sym = ffi/resolve lib (if is_win [ 'GetCurrentProcessId' ] else [ 'getpid' ])
pid = ffi/call-c pid_sym []
_ = ffi/close-lib lib
Next Steps
- Explore copy-ready idioms in the Veko Cookbook.
- Review CLI flags and
veko.vkcapability rules in Configuration & CLI Reference. - Return to the End-User Documentation Hub.
Part XI: Performance, Hardware Intrinsics & AArch64 Cross-Compilation Guide
Veko delivers predictable, low-latency native execution strictly without a JIT compiler and with zero W^X (write-then-execute) memory pages. Every native binary is compiled ahead-of-time (AOT) directly from Veko's 64-bit VKO intermediate representation into standalone machine code across 5 zero-dependency OS/CPU targets — Windows x86_64 (win-x64), Windows 11 ARM64 (win-arm64), Linux x86_64 (linux-x64), Linux AArch64 (linux-arm64), and macOS Apple Silicon (macos-arm64) — with zero external C compiler, LLVM, libc, or crypto library dependencies.
1. Strict No-JIT & Zero-W^X Execution Model
64-Bit VKO ISA, Hardware SIMD & Four-Target Native Binary Emitters
Zero-JIT, zero-W^X compilation from typed ASTs to superinstruction bytecode, x86_64, and AArch64 executables.
Across all three execution tracks, Veko enforces strict separation between writable memory and executable code:
- Track A (
--vm/.vko): The pure-Veko 64-bit bytecode VM (oro_vm.vk) uses fused superinstructions (LOAD_CONST_ADD,LOAD_CONST_LT_JMP_FALSE,LOCAL_INC,LOAD_LOCAL_INDEX,LOAD_LOCAL_LEN), shared devirtualization, guarded leaf inlining, optional--fuel=<n>instruction quotas, and.secret-preserving native fast-paths for modular big-integer/Curve25519/Keccak-f[1600]/SHA-2 kernels so even interpretedveko runcompletes full post-quantum TLS 1.3 HTTPS handshakes in milliseconds without allocating executable heap pages. - Track B (
--wasm/vvm): Compiles to validated WebAssembly 3.0 with hardwaref64.sqrt, bulk memory ops, unboxedi64/f64loops, and capability-confinedHostSandboxisolation. - Track C (
--native): Emits standalone OS executables directly for five OS/CPU architectures and platforms:--target=win-x64— Windows x86_64 64-bit PE32+ executable (kernel32.dll/ws2_32.dllonly, optional--gui)--target=win-arm64— Windows 11 ARM64 64-bit PE32+ (0xAA64) executable (kernel32.dll/ws2_32.dllonly, optional--gui— Snapdragon X Elite/Plus, Surface Pro/Laptop, Windows on ARM VMs)--target=linux-x64— Static zero-libcLinux x86_64 ELF64 executable (direct Linux syscalls)--target=linux-arm64— Static zero-libcLinux AArch64 (arm64) ELF64 executable (directasm-genericLinux syscalls — AWS Graviton, Ampere, Raspberry Pi 5)--target=macos-arm64— 16 KiB-aligned Apple Silicon M1–M4 Mach-OMH_EXECUTEbinary withdyldchained fixups,/usr/lib/libSystem.B.dylibstubs, and automatic pure-Veko SHA-256 ad-hocLC_CODE_SIGNATURE
On x86_64 native targets, startup performs a single read-only CPUID + XGETBV probe (SSE2, AVX2, AES-NI) and dispatches hot byte and cryptographic loops automatically to the widest supported instruction set—falling back cleanly to constant-time scalar code on older CPUs.
2. Hardware & Bulk Byte Intrinsics (3-Track Parity)
Six built-in primitives accelerate numeric, buffer-scanning, and cryptographic workloads across all three backends with bit-identical semantics:
| Builtin | Arity | Description | Native Hardware Acceleration |
|---|---|---|---|
f64/sqrt |
1 |
IEEE-754 double-precision square root | SQRTSD (x86_64), FSQRT (AArch64), f64.sqrt (Wasm 3.0) |
bytes/eq |
2 |
Exact byte-buffer equality check | AVX2 32B / SSE2 16B lanes (x86_64), 8B word loop (AArch64) |
bytes/index-of |
2 |
First byte offset of needle in haystack, or -1 |
AVX2 / SSE2 PMOVMSKB scan (x86_64), fast prefix scan (AArch64) |
bytes/xor |
2 |
Returns a new bytes buffer XORing two equal-length buffers |
AVX2 32B / SSE2 16B VPXOR/PXOR (x86_64), 8B EOR loop (AArch64) |
bytes/xor! |
2 |
In-place ORO mut XOR (bytes/xor! mut dst mask) with zero allocation |
AVX2 32B / SSE2 16B in-place vector XOR (x86_64), 8B EOR loop (AArch64) |
bytes/aes-enc-block |
2 |
Single-block AES-128/192/256 encryption (blk16, rk) |
Hardware AESENC/AESENCLAST (x86_64 AES-NI), constant-time branchless algebraic GF(2^8) fallback (AArch64 / non-AES-NI / Wasm / VM) |
Example: Using Hardware & Bulk Intrinsics
use [m = math, bits, hex = codec/hex, aes = crypto/aes]
// Hardware IEEE-754 square root (`math/sqrt` delegates to `f64/sqrt`)
root2 = f64/sqrt 2.0
// Bulk SIMD equality, search, and zero-allocation in-place XOR
hay = bytes/from-str 'veko-simd-acceleration-pipeline-sentinel-99'
idx = bytes/index-of hay (bytes/from-str 'sentinel-99')
mut payload = bytes/from-str '0123456789abcdef'
mask = bytes/fill 16 0x5a
_ = bytes/xor! mut payload mask
_ = bytes/xor! mut payload mask
ok = bytes/eq payload (bytes/from-str '0123456789abcdef')
// NIST FIPS-197 AES-256 block & AES-256-GCM AEAD (automatically uses AES-NI when present)
key = hex/decode '000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f'
pt = hex/decode '00112233445566778899aabbccddeeff'
ct = aes/encrypt-block key pt // '8ea2b7ca516745bfeafc49904b496089'
// Table-driven IEEE 802.3 CRC32 (256-entry Sarwate table in `lib/bits.vk`)
sum = bits/crc32 (bytes/from-str '123456789') // 0xcbf43926
Run the complete self-verifying demonstration (examples/28_simd_optimization_and_arm64_cross_compile.vk) across all tracks:
veko run examples/28_simd_optimization_and_arm64_cross_compile.vk
veko run --wasm --fuel=0 --check-slabs examples/28_simd_optimization_and_arm64_cross_compile.vk
veko run --native examples/28_simd_optimization_and_arm64_cross_compile.vk
3. Content-Addressed Incremental Cache & veko run --native
Veko accelerates both interactive type-checking and AOT native builds via a deterministic content-addressed cache under dist/.veko_cache/ (bypassable anytime with --no-cache):
- Frontend & Binary Cache (
dist/.veko_cache/mod_v1/): Keyed by a SHA-256 digest over the compiler binary fingerprint, embedded'VFS2'stdlib fingerprint (stdlib_vfs.bin, lazy per-module zlib decompression), target triple,--strict-types/--guiflags, andFNV-1a+mtimecontent hashes of all transitive modules. - Warm Sub-50ms Turnaround: On a 42-module production server (
veko-site, including TLS 1.3, HTTP/2, QUIC HTTP/3, and Zero-FFI SQLite), coldveko checkcompletes in~2.7sand warmveko checkin~43 ms; coldveko compile --nativecompletes in~9.7sand warmveko compile --nativein~48 ms. Pass--no-cache(used automatically bybuild.vk -- fixed-point) to force a full uncached rebuild and verifyS1 == S2bit-identical determinism. - Native Codegen Fast-Paths (
native_emit.vk&x64_enc.vk): Unboxedvstackloop conditions fusewhile i < (len xs)into 3 machine instructions with zero[R13]stack spills orrt_releasecalls, inline bounds-checkedbytes[i]loads, and patchx64jump/call relocations in $O(L + F)$ in-place passes.
For scripts and benchmarks that want full native throughput without managing output paths manually, use veko run --native:
veko run --native benchmarks/bench_suite.vk
veko compile --native --no-cache src/main.vk -o dist/app.exe
4. Cross-Compiling to AArch64 (win-arm64, linux-arm64 & macos-arm64)
Every veko binary includes both the x86_64 and AArch64 native code generators and linkers built in. You can cross-compile from any host OS to any of the 5 supported targets in a single command—no cross-compilers, Docker toolchains, Visual Studio Build Tools, or Xcode SDKs are required.
Target Matrix
--target |
Architecture | Binary Format | Runtime ABI & Linking | Signing / Permissions |
|---|---|---|---|---|
win-x64 |
x86_64 | PE32+ (.exe, 0x8664) |
kernel32.dll + ws2_32.dll IAT (--gui optional) |
Standard Windows x64 executable |
win-arm64 |
AArch64 (arm64) |
PE32+ (.exe, 0xAA64) |
kernel32.dll + ws2_32.dll IAT (--gui optional) |
Native Windows 11 ARM64 executable (zero x64 emulation) |
linux-x64 |
x86_64 | Static ELF64 (ET_EXEC) |
Direct Linux syscalls (zero libc) |
Automatic 0o755 executable mode |
linux-arm64 |
AArch64 (arm64) |
Static ELF64 (EM_AARCH64) |
Direct asm-generic Linux syscalls (zero libc) |
Automatic 0o755 executable mode |
macos-arm64 |
AArch64 (arm64) |
16 KiB Mach-O MH_EXECUTE |
dyld chained fixups + /usr/lib/libSystem.B.dylib stubs |
Built-in pure-Veko SHA-256 ad-hoc LC_CODE_SIGNATURE |
Cross-Compile Commands
# Windows 11 ARM64 PE32+ (0xAA64) binary (Snapdragon X Elite/Plus, Surface Pro/Laptop, Windows on ARM VMs)
veko compile --native --target=win-arm64 examples/28_simd_optimization_and_arm64_cross_compile.vk -o dist/app_win_arm64.exe
# Static Linux AArch64 (arm64) binary (runs on Raspberry Pi 4/5, AWS Graviton, Ampere, or QEMU)
veko compile --native --target=linux-arm64 examples/28_simd_optimization_and_arm64_cross_compile.vk -o dist/app_linux_arm64
# Apple Silicon macOS arm64 binary (16 KiB pages + automatic ad-hoc SHA-256 LC_CODE_SIGNATURE)
veko compile --native --target=macos-arm64 examples/28_simd_optimization_and_arm64_cross_compile.vk -o dist/app_macos_arm64
# Self-host the full Veko compiler itself for Windows arm64, Linux arm64, or macOS arm64
veko compile --native --target=win-arm64 src/main.vk -o dist/veko_win_arm64.exe
veko compile --native --target=linux-arm64 src/main.vk -o dist/veko_linux_arm64
veko compile --native --target=macos-arm64 src/main.vk -o dist/veko_macos_arm64
Deploying win-arm64 Binaries on Windows 11 on ARM
--target=win-arm64 emits a native AArch64 PE32+ (IMAGE_FILE_MACHINE_ARM64 = 0xAA64) executable using the Windows ARM64 AAPCS64 calling convention (X0..X7 integer arguments, X18 reserved for the Win32 TEB, ADRP+LDR Win32 IAT thunks). Binaries execute directly on Snapdragon X Elite/Plus workstations, Surface Pro/Laptop devices, and Azure/AWS Windows on ARM instances with zero Prism x64 binary-translation overhead, and veko run --native / veko compile --native auto-detect Windows ARM64 hosts automatically.
Testing linux-arm64 Binaries on x86_64 Hosts via QEMU
On Linux or Windows WSL2 (Ubuntu/Debian), install user-mode QEMU emulation and execute linux-arm64 binaries directly:
sudo apt-get update && sudo apt-get install -y qemu-user
qemu-aarch64 ./dist/app_linux_arm64
Deploying macos-arm64 Binaries on Apple Silicon
Apple Silicon (arm64) macOS requires every executable to be 16 KiB page-aligned and signed with at least an ad-hoc LC_CODE_SIGNATURE containing SHA-256 hashes of every 4 KiB code page. Veko's built-in Mach-O linker (macho_emit.vk) computes and embeds the full CS_MAGIC_EMBEDDED_SIGNATURE / CS_MAGIC_CODEDIRECTORY SHA-256 blob automatically (and unlinks any existing Mach-O target before writing to avoid APFS code-signing vnode cache SIGKILL), while veko run --native, veko compile --native, and veko doc --test --native auto-detect Apple Silicon (macos-arm64) and Linux AArch64 (linux-arm64) hosts out of the box without requiring --target, codesign, or Xcode.
5. Benchmarking Across All Three Tracks
Run Veko's reproducible benchmark suite (benchmarks/bench_suite.vk) to measure native, Wasm 3.0, and bytecode VM throughput on your machine:
veko run --native benchmarks/bench_suite.vk
veko run --wasm --fuel=0 benchmarks/bench_suite.vk
veko run benchmarks/bench_suite.vk
The suite benchmarks 9 real-world pure-Veko workloads: math/sqrt+sin, bits/crc32 (1 KiB), seq/sort (64 ints), regex/find-all, compress/gzip, crypto/sha3-256 (1 KiB), crypto/blake2b-256 (1 KiB), crypto/aes-256-gcm, and crypto/mlkem-512 post-quantum encapsulation.
Part XII: Runnable Examples & Showcase Applications
Every example in examples/ (42 runnable programs) and every multi-module showcase application in demos/ (6 complete applications, including the 29-widget demos/widget_gallery desktop UI suite) executes across Veko's three execution tracks: the 64-bit VKO bytecode VM (veko run), WebAssembly 3.0 sandbox (veko run --wasm), and standalone native executables (veko run --native or veko compile --native [--target=<win-x64|win-arm64|linux-x64|linux-arm64|macos-arm64>]).
Veko 1.0 Self-Hosted Toolchain & Triple-Target S1 == S2 Fixed Point
How the 39-module pure-Veko compiler compiles itself to bit-identical native binaries across architectures.
1. Runnable Example Catalog (examples/)
| Example File | Focus | Run Command |
|---|---|---|
examples/01_basics_and_math.vk |
Rich literals (250ms, 4kb, .tcp), bitwise ops, ranges, loops |
veko run examples/01_basics_and_math.vk |
examples/02_pipelines_and_json.vk |
use aliases, \ pipes, json/decode, filter/map/reduce, match |
veko run examples/02_pipelines_and_json.vk |
examples/03_oro_buffers_and_errors.vk |
mut buffer loans, bytes/with-secret, defer, /or, recur |
veko run examples/03_oro_buffers_and_errors.vk |
examples/04_macros_and_dialects.vk |
quote, compose/deep, parse-block, compile-time macro |
veko run examples/04_macros_and_dialects.vk |
examples/05_closures_and_capabilities.vk |
Stateful ORO closures & explicit non-OOP capability records | veko run examples/05_closures_and_capabilities.vk |
examples/06_policy_firewall_compiler.vk |
Declarative parse-block policy compiler & stateful ORO rate-limiter |
veko run examples/06_policy_firewall_compiler.vk |
examples/07_binary_frame_codec.vk |
Binary wire-protocol encoder/decoder, XOR checksum & ascii normalization |
veko run examples/07_binary_frame_codec.vk |
examples/08_kv_store_and_audit_log.vk |
Single-owner ORO KV store, hash-chained recur audit log & secret zeroing |
veko run examples/08_kv_store_and_audit_log.vk |
examples/09_concurrent_worker_pool.vk |
Shared-nothing spawn worker pool, chan/select, timeouts & isolation guards |
veko run --wasm examples/09_concurrent_worker_pool.vk |
examples/10_loopback_tcp_echo_service.vk |
Loopback TCP server-client, mut buffers & .secret firewall |
veko run --wasm --allow-net --allow-listen --allow-private-net examples/10_loopback_tcp_echo_service.vk |
examples/11_modular_service/src/main.vk |
Multi-file veko.vk manifest, pub/export, macro + spawn worker pipeline |
veko run --wasm examples/11_modular_service/src/main.vk |
examples/12_typed_structs_and_secrets.vk |
Typed struct slots, struct/with, secret governance, veko check --strict-types |
veko run --wasm examples/12_typed_structs_and_secrets.vk |
examples/13_pure_vk_tls13_and_codecs.vk |
Pure-.vk codec/der, codec/pem, codec/http1, X.509 & loopback RFC 8446 TLS 1.3 handshake |
veko run --native examples/13_pure_vk_tls13_and_codecs.vk |
examples/14_http_json_api_server.vk |
Multi-worker concurrent HTTP/1.1 + JSON REST microservice (spawn store actor + worker pool) |
veko run --allow-net --allow-listen --allow-private-net examples/14_http_json_api_server.vk |
examples/15_encrypted_vault_cli.vk |
Authenticated encrypted file vault (HKDF-SHA256, ChaCha20-Poly1305, Ed25519) |
veko run --wasm --fuel=0 examples/15_encrypted_vault_cli.vk |
examples/16_query_dialect_engine.vk |
Homoiconic VQL telemetry query & stream dialect (quote, parse-block, macro) |
veko run examples/16_query_dialect_engine.vk |
examples/17_stdlib_cli_fmt_and_collections.vk |
cli parser, fmt tables/units, testing, math, text, path, seq, coll, rand |
veko run examples/17_stdlib_cli_fmt_and_collections.vk |
examples/18_io_streams_regex_and_codecs.vk |
buf, io SchemeMux, glob, Thompson NFA regex, dialect, codec/*, compress/deflate |
veko run examples/18_io_streams_regex_and_codecs.vk |
examples/19_modern_crypto_and_sealed_vault.vk |
SHA3/SHAKE, BLAKE2b, Argon2id, AES-256-GCM, XChaCha20-Poly1305, crypto/seal, ECDSA P-256 |
veko run --native examples/19_modern_crypto_and_sealed_vault.vk |
examples/20_post_quantum_nist_pqc.vk |
NIST FIPS 203 ML-KEM-768, FIPS 204 ML-DSA-65, and FIPS 205 SLH-DSA-SHAKE-128f |
veko run --native examples/20_post_quantum_nist_pqc.vk |
examples/21_io_streams_dns_and_pqc_tls.vk |
UUID v7, io/fs, net/dns, and Hybrid Post-Quantum TLS 1.3 (X25519MLKEM768) + HTTP/2 |
veko run --native examples/21_io_streams_dns_and_pqc_tls.vk |
examples/22_web_server_websocket_and_jwt.vk |
OAuth2 PKCE, HS256/EdDSA/ML-DSA-65 JWTs, web server, and RFC 6455 net/websocket |
veko run --native examples/22_web_server_websocket_and_jwt.vk |
examples/23_zero_ffi_databases_kv_pg_redis.vk |
Embedded WAL db/kv, PostgreSQL v3 (SCRAM-SHA-256), Redis RESP3, and db/sidecar |
veko run --native examples/23_zero_ffi_databases_kv_pg_redis.vk |
examples/24_signed_vkp_package_bundles.vk |
Dual-signed Ed25519 + ML-DSA-65 'VKP1' Merkle package bundle creation & verification |
veko run --native examples/24_signed_vkp_package_bundles.vk |
examples/25_batteries_datetime_fs_archives_and_toml.vk |
datetime, utf8, fs, slog, archive/tar & zip, codec/toml, net/ip, semver, totp |
veko run examples/25_batteries_datetime_fs_archives_and_toml.vk |
examples/26_pure_vk_html_components_and_http_client.vk |
Auto-escaped html components, template, web/page + gzip, and 3-track net/client |
veko run --native examples/26_pure_vk_html_components_and_http_client.vk |
examples/27_tooling_fmt_lsp_and_v2vk.vk |
Self-hosted veko fmt, live veko lsp JSON-RPC 2.0 session, and veko v2vk migrator |
veko run examples/27_tooling_fmt_lsp_and_v2vk.vk |
examples/28_simd_optimization_and_arm64_cross_compile.vk |
f64/sqrt, SIMD bytes/{eq,index-of,xor!,aes-enc-block}, and linux-arm64/macos-arm64 emit |
veko run --native examples/28_simd_optimization_and_arm64_cross_compile.vk |
examples/29_async_reactor_http_server_and_client.vk |
OS readiness reactor (epoll/kqueue/IOCP), timers, web/serve-reactor, and get-many |
veko run --native examples/29_async_reactor_http_server_and_client.vk |
examples/30_tui_and_native_ui_canvas.vk |
TrueColor diffing tui, zero-copy RGBA32 ui/canvas & ui/widgets, .ui window, BMP export |
veko run --native examples/30_tui_and_native_ui_canvas.vk |
examples/31_opt_in_ffi_and_c_struct_packing.vk |
Opt-in .ffi native shared library calls (kernel32.dll / libc.so.6) & C-struct packing |
veko run --allow-ffi examples/31_opt_in_ffi_and_c_struct_packing.vk |
examples/32_durable_objects_and_workflows.vk |
Transactional durable/object actors, alarms, inboxes, and replay-safe durable/workflow sagas |
veko run --native examples/32_durable_objects_and_workflows.vk |
examples/33_ergonomic_refinements_templates_and_interfaces.vk |
User /refinements, universal /or [e -> ...], .secret templates, 2-var for, destructuring, and interface |
veko -A examples/33_ergonomic_refinements_templates_and_interfaces.vk |
examples/34_png_charts_and_flex_widgets.vk |
Light-Mode ui/widgets (stat-card, bar-chart, line-chart, flex/grid) and lossless image/png roundtrip |
veko examples/34_png_charts_and_flex_widgets.vk |
examples/35_sse_multipart_and_kv_queries.vk |
SSE streaming, multipart/form-data, HTTP 206 Range slices, indexed db/query, and conc/scope |
veko -A examples/35_sse_multipart_and_kv_queries.vk |
examples/36_regex_zstd_otel_and_bindgen.vk |
Linear-time Thompson NFA text/re, RFC 8878 compress/zstd, and W3C/OTLP/Prometheus otel |
veko examples/36_regex_zstd_otel_and_bindgen.vk |
examples/37_clipboard_x11_flamegraph_and_lock.vk |
.secret-firewalled clipboard & Hi-DPI, X11 wire-protocol framing, SVG flamegraphs, and veko.lock |
veko -A examples/37_clipboard_x11_flamegraph_and_lock.vk |
examples/hello.vk, examples/tour.vk, examples/oro_closures.vk, examples/dialects.vk |
Bite-sized introductory tours of syntax, pipes, ORO closures, and block dialects | veko run examples/hello.vk |
benchmarks/bench_suite.vk |
Cross-subsystem benchmark suite (math, CRC-32, regex, gzip, SHA3, AES-GCM, ML-KEM) | veko run --native benchmarks/bench_suite.vk |
2. Basics, Bitwise Ring Buffers & Slicing (01_basics_and_math.vk)
title = 'Veko Basics'
timeout = 250ms
buf-cap = 4kb
proto = .tcp
head = 12
offset = 7
cap = 16
next-slot = (head + offset) & (cap - 1) // 3
nums = 1..=5
println (mold nums[1..4]) // [2 3 4]
3. JSON Filtering, Reduction & match (02_pipelines_and_json.vk)
use [j = json, s = strings]
payload = '[{"name": " alpha ", "score": 90, "active": true}, {"name": " beta ", "score": 40, "active": false}, {"name": " gamma ", "score": 85, "active": true}]'
names = payload
\ j/decode
\ filter fn [item] [item.active]
\ map fn [item] [item.name.trim.upper]
println (s/join names ' | ') // ALPHA | GAMMA
ev = { kind = .ready, code = 200 }
status-msg = match ev.kind [
.starting ['booting']
.ready ['serving']
_ ['unknown']
]
4. Zero-Alloc Buffers, Secrets, defer, /or & recur (03_oro_buffers_and_errors.vk)
use [bytes, ascii, str]
pkt = bytes/with-cap 4kb
bytes/push-all mut pkt (bytes/from-str ' ping trustnode ')
ascii/trim-right! mut pkt
ascii/upper! mut pkt
bytes/push mut pkt 33
println (str/from-bytes pkt) // PING TRUSTNODE!
safe-find = fn [hay needle] [
defer [println 'cleanup-done']
str/index-of/or hay needle [-1]
]
5. Homoiconic Dialects & Compile-Time Macros (04_macros_and_dialects.vk)
mut endpoints = []
parsed-ok = parse-block (quote [allow .tcp '10.1.0.0/16' 443 allow .udp '10.2.0.0/16' 51820]) [
any [
['allow' proto = enum! cidr = str! p = int!] [
push mut endpoints (compose [(proto) (cidr) (p)])
]
]
]
triple = macro [x] [
compose [(x) + (x) + (x)]
]
println (triple 14) // 42
6. Capability Records Without OOP (05_closures_and_capabilities.vk)
use [str]
make-logger = fn [prefix] [
{
info = fn [msg] [println (str/append prefix msg)]
warn = fn [msg] [println (str/append '[WARN] ' msg)]
flush = fn [] [println (str/append prefix 'flushed')]
}
]
app-log = make-logger '[veko] '
log-info = app-log.info
(log-info 'initialized')
call app-log.flush
7. Zero-Trust Policy Firewall Compiler (06_policy_firewall_compiler.vk)
Combines homoiconic quote/parse-block rule extraction with a captured ORO map inside make-evaluator to rate-limit, require .mtls, and enforce default-deny verdicts across simulated traffic:
policy-spec = quote [
default .deny
route .tcp '10.10.' 8443 .mtls 2
route .udp '192.168.' 51820 .open 5
route .tcp '0.0.0.' 80 .deny 0
]
ok = parse-block policy-spec [
any [
['default' act = enum!] [ default-action = act ]
['route' p = enum! c = str! pt = int! a = enum! lim = int!] [
push mut rules (make-rule p c pt a lim)
]
]
]
Expected output (veko run examples/06_policy_firewall_compiler.vk):
compiled-rules=3
NO_MTLS 10.10.4.20 8443
ALLOW 10.10.4.20 8443
ALLOW 10.10.4.20 8443
LIMIT 10.10.4.20 8443
ALLOW 192.168.1.9 51820
BLOCK 0.0.0.5 80
DENY_DEFAULT 172.16.0.1 9999
8. Binary Wire Frame Codec & In-Place Normalization (07_binary_frame_codec.vk)
Demonstrates big-endian length framing (0x54 0x4e magic, version, opcode, XOR checksum), borrowing mut buffer parameters for zero-copy header/slice reads, in-place ascii/trim-right! + ascii/upper! normalization, and /or fallback on corrupt trailing bytes:
decoded = decode-and-normalize/or mut pkt [{ error = 'decode-failed' }]
println (mold decoded)
mut bad-pkt = bytes/with-cap pkt.len
bytes/push-all mut bad-pkt pkt
bytes/push mut bad-pkt 0xff
bad-res = decode-and-normalize/or mut bad-pkt ['recovered-corrupt-frame']
println bad-res
Expected output (veko run examples/07_binary_frame_codec.vk):
25
TN
{version = 1, op = 7, payload = ' PING TRUSTNODE'}
recovered-corrupt-frame
9. Single-Owner ORO KV Store & Hash-Chained Audit Log (08_kv_store_and_audit_log.vk)
Encapsulates data, audit, and tip-hash inside one single-owner ORO dispatcher closure (make-kv-store), derives a temporary secret seed inside bytes/with-secret 64b that wipes deterministically on scope return, verifies the hash chain in constant stack via recur, and checks json/encode / json/decode round-tripping:
verify-chain = fn [entries idx prev-hash] [
if idx >= entries.len [return true]
entry = entries[idx]
expected = hash (str/join [prev-hash entry.op entry.key] '|')
if entry.sig != expected [return false]
recur entries (idx + 1) expected
]
snap = (kv .snapshot .none .none)
encoded = j/encode snap
reloaded = j/decode encoded
Expected output (veko run examples/08_kv_store_and_audit_log.vk):
127.0.0.1
8443
audit-valid=true
entries=3
roundtrip-keys=3
10. Shared-Nothing Concurrent Worker Pool (09_concurrent_worker_pool.vk)
Demonstrates structured shared-nothing concurrency across all three backends (vm_oro, backend_wasm, and native_emit.vk) with zero shared mutable heaps or GC pauses: fans jobs out to isolated spawn [ ... ] OS-thread workers over bounded FIFO channels (chan/new, chan/send, chan/recv), multiplexes priority lanes with chan/select, recovers deterministically from slow workers via task/await/timeout/or, and proves that .secret slabs, mut borrows, and closures cannot cross chan/send:
w1 = spawn [
mut processed = 0
forever [
item = chan/recv/or fast-q [break]
chan/send out-q (transform-job item)
processed = processed + 1
]
processed
]
picked = chan/select [lane-a lane-b]
sec-guard = chan/send/or out-q tok ['secret-blocked']
Expected output (veko run --wasm examples/09_concurrent_worker_pool.vk):
queue-empty
total-score=116
workers-done=2
selected-lane=1:priority-alert
deadline-exceeded
completed-after-deadline
secret-blocked
mut-loan-blocked
closure-blocked
11. Loopback TCP Service Across Isolated Workers (10_loopback_tcp_echo_service.vk)
Runs a full client/server session over host OS sockets (--vm), wasi:sockets@0.3.0 + wasi:io/async@0.3.0 (--wasm), or WinSock2 / Linux POSIX sockets (--native). Binds an ephemeral local socket (net/listen-tcp .ip '127.0.0.1:0'), spawns a client worker dialing net/connect-tcp, blocks .secret buffer transmission via net/write/or, reads into a pre-allocated ORO mut buffer (net/read-into), normalizes bytes in place (ascii/trim-right!, ascii/upper!), and tears down cleanly:
ln = net/listen-tcp .ip '127.0.0.1:0'
client-worker = spawn [
cli = net/connect-tcp '127.0.0.1' port
sec-verdict = net/write/or cli api-key 'secret-write-blocked'
net/write-string cli ' hello veko socket '
reply = net/read-bytes cli 64
net/close cli
{ sec = sec-verdict, reply = (bytes/to-str reply) }
]
Expected output (veko run --wasm --allow-net --allow-listen --allow-private-net examples/10_loopback_tcp_echo_service.vk):
server-rx-bytes=21
client-secret-guard=secret-write-blocked
client-rx= HELLO VEKO SOCKET
12. Multi-File Modular Service (11_modular_service/)
Combines logical modules and least-privilege veko.vk capability manifests (allow-caps = [.clocks]) with concurrent worker threads: private helpers in lib/protocol stay encapsulated while pub format-telemetry and compile-time alert-threshold execute identically across vm_oro, veko inspect --modules, isolated Wasm worker sandboxes, and --native executables:
use [proto = lib/protocol, str]
limit = proto/alert-threshold 80 15
w1 = spawn [
pkt = proto/format-telemetry 'edge-west-01' 1 'cpu=42%'
chan/send outbox pkt
'ok-w1'
]
Expected output (veko run --wasm examples/11_modular_service/src/main.vk):
threshold=95
over-limit=true
workers=ok-w1,ok-w2
packets=2
csum-sum=1199
clock-ok=true
13. Typed Structs, .secret Governance & Unboxed Loops (12_typed_structs_and_secrets.vk)
Demonstrates static verification and performance together cleanly under veko check --strict-types, --vm, --wasm, and --native: fixed-schema Upstream and RouteSummary structs with defaults and secret str fields, pure immutable updates via struct/with, os/getenv/secret and bytes/with-secret redaction/JSON-blocking, checked conversions (str/to-i64, as-u8), runtime entry type guards, and an unboxed typed i64 register loop:
compute-weight = fn [ep Upstream, factor u8, samples i64] i64 [
mut acc = 0
mut i = 0
while i < samples [
acc = acc + (i & 7) + factor
i = i + 1
]
acc + ep.port
]
standby = primary \ struct/with { name = 'edge-eu', host = 'eu.veko.local', port = parsed-port }
score = compute-weight standby ok-u8 5000
Expected output (veko check --strict-types examples/12_typed_structs_and_secrets.vk + veko run --wasm examples/12_typed_structs_and_secrets.vk):
secret-buf-mold=<secret>
target=edge-eu:eu.veko.local:8443
bad-port=-1
clamped-u8=255
summary={"name":"edge-eu","host":"eu.veko.local","port":8443,"load":85943}
14. Pure-Veko DER/PEM/HTTP Codecs, X.509 & Loopback TLS 1.3 (13_pure_vk_tls13_and_codecs.vk)
Demonstrates Veko's 100% pure-.vk protocol and cryptographic stack (codec/der with parse-block AST nodes, codec/pem, codec/http1, crypto/sha256, crypto/x25519 Ed25519, crypto/x509 SPKI pinning, and net/tls13) executing an in-process loopback RFC 8446 TLS 1.3 + HTTP/1.1 exchange with zero OS crypto DLLs:
veko run --allow-net --allow-listen --allow-private-net examples/13_pure_vk_tls13_and_codecs.vk
veko run --wasm --fuel=0 --allow-net --allow-listen --allow-private-net examples/13_pure_vk_tls13_and_codecs.vk
veko compile --native examples/13_pure_vk_tls13_and_codecs.vk -o dist/13.exe ; ./dist/13.exe
15. Concurrent HTTP/1.1 + JSON REST Microservice (14_http_json_api_server.vk)
Demonstrates a multi-worker concurrent HTTP/1.1 + JSON REST microservice across all three backends using typed structs (TaskItem, ApiMetrics + struct/with), a channel-owned spawn store actor, a 2-worker spawn pool with reusable per-worker reply_ch, net/listen-tcp .ip '127.0.0.1:0', codec/http1, parse-block (http/request-to-block ...), json/decode/or + json/encode/or, time/now/time/since, and .secret JSON firewall enforcement:
req_blk_ok = parse-block (http/request-to-block sample_req) [
any [
[.req m = str! t = str! _v = str! _h = map! _b = any!] [
parsed_method = m
parsed_target = t
]
]
]
Run across all three backends (veko check -> 2 module(s), 2 struct(s), 22 typed fn(s)):
veko check examples/14_http_json_api_server.vk
veko run --allow-net --allow-listen --allow-private-net examples/14_http_json_api_server.vk
veko compile --vko examples/14_http_json_api_server.vk -o dist/14.vko ; veko run --allow-net --allow-listen --allow-private-net dist/14.vko
veko run --wasm --allow-net --allow-listen --allow-private-net examples/14_http_json_api_server.vk
veko compile --native examples/14_http_json_api_server.vk -o dist/14.exe ; ./dist/14.exe
Expected output (identical 10 lines across --vm, .vko, --wasm, and --native):
secret-firewall=secret-json-blocked
req-block-parsed=true:POST:/items
health=200:'ok'
created-ids=1,2|statuses=201,201
malformed-json=400:'invalid_json'
list-count=2
done-item1=200:done=true
missing-item=404:'not_found'
metrics=handled:8,created:2,workers:2
pool=accepted:8,served:8,actor:8,timing-ok=true
16. Authenticated Encrypted File Vault CLI (15_encrypted_vault_cli.vk)
Implements an authenticated encrypted file vault and Ed25519-signed multi-block PEM manifest CLI using HKDF-SHA256, ChaCha20-Poly1305 AEAD, HMAC-SHA256 + ct-eq, Ed25519, codec/pem + parse-block, bytes/with-secret, os/getenv/secret, and os/args. Invoking with zero arguments runs an in-process self-demo (including Ed25519 tamper, AEAD tamper, wrong-passphrase, and .secret firewall tests) and scrubs the temporary demo file; passing arguments invokes the init, set, get, list, verify, or --help CLI subcommands with --pass <pw>.
Run across all three backends (veko check -> 5 module(s), 2 struct(s), 84 typed fn(s)):
veko check examples/15_encrypted_vault_cli.vk
veko run examples/15_encrypted_vault_cli.vk
veko run --wasm --fuel=0 examples/15_encrypted_vault_cli.vk
veko compile --native examples/15_encrypted_vault_cli.vk -o dist/15.exe ; ./dist/15.exe
# Interactive CLI subcommands (pass --allow-fs on --wasm)
veko run examples/15_encrypted_vault_cli.vk -- init vault.pem --pass mypw
veko run --wasm --allow-fs --fuel=0 examples/15_encrypted_vault_cli.vk -- init vault.pem --pass mypw
Expected self-demo output:
vault-secret-mold=<secret>|name=master
vault-secret-firewall=secret-json-blocked
vault-sealed=exists:true,entries:3,cipher:chacha20-poly1305
vault-ed25519-verify=true
vault-unseal=api:tok_prod_veko_991,db:postgres://vault.local/app,tls:sha256/veko-spki-pin
tamper-ed25519-rejected=true
tamper-aead-rejected=true
wrong-pass-rejected=true
demo-scrubbed=true
17. Homoiconic VQL Telemetry Query & Dialect Engine (16_query_dialect_engine.vk)
Combines homoiconic quote, parse-block AST compilation, compile-time macros (sla-budget, sla-floor), compose/deep, typed structs (TraceSpan, QueryPlan + struct/with), filter/map/reduce, match, tail-recursive recur, str/to-i64/or, as-u8/or, and an optional os/args[0] latency threshold override:
veko check examples/16_query_dialect_engine.vk
veko run examples/16_query_dialect_engine.vk
veko compile --vko examples/16_query_dialect_engine.vk -o dist/16.vko ; veko run dist/16.vko
veko run --wasm examples/16_query_dialect_engine.vk
veko compile --native examples/16_query_dialect_engine.vk -o dist/16.exe ; ./dist/16.exe
./dist/16.exe 200
Expected output:
vql-parsed=true|name=edge-5xx-slow|clauses=3
vql-matched=3|limited=2|sum-bytes=7520
vql-rows=1:edge-gateway@eu-west:502:145ms,4:edge-gateway@eu-west:504:320ms
macro-plan={"name":"sla-watchdog","svc":"edge-gateway","min_ms":100,"status_min":500,"region":"eu-west","limit":5,"agg":"sum_bytes"}
sla-budget=240|breaches=2|max-ms=320|clamped-u8=255
report-ast=[vql 'edge-5xx-slow' [parsed true matched 3 returned 2 sum_bytes 7520] sla [plan 'sla-watchdog' budget_ms 240 breaches 2 max_ms 320]]
17b. Systems, Networking, Async Reactor, UI/FFI & Durable Workflow Examples (21..32)
Twelve end-to-end systems examples exercise Veko 1.0's connected networking, web/auth, zero-FFI databases, signed packages, developer tooling, hardware SIMD & ARM64 cross-compilation, readiness reactor, TUI/native UI, opt-in FFI, and durable workflows:
examples/21_io_streams_dns_and_pqc_tls.vk: Time-ordered UUID v7, positionedio/fsstreams,net/dnsresolution, and a live loopback Hybrid Post-Quantum TLS 1.3 (X25519MLKEM768) + ALPN'h2'+net/http2RPC.examples/22_web_server_websocket_and_jwt.vk: OAuth 2.0 PKCES256,HS256/EdDSA/ML-DSA-65JWTs,webroutes with security headers/SSE, and live RFC 6455net/websocketupgrade + masked frames.examples/23_zero_ffi_databases_kv_pg_redis.vk: Embedded WAL KV store (db/kv+ AES-256-GCMput-sealed), loopback PostgreSQL v3 (SCRAM-SHA-256), pipelined Redis RESP3 (db/redis), and'VKSC'db/sidecarframes.examples/24_signed_vkp_package_bundles.vk: Packs and verifies a multi-module'VKP1'archive dual-signed with Ed25519 + ML-DSA-65 (pkg/vkp).examples/25_batteries_datetime_fs_archives_and_toml.vk: Exercisesdatetime,utf8,fs,slog,archive/tar(.tar.gz),archive/zip,codec/toml,net/ip,semver,auth/totp,diff, andretry.examples/26_pure_vk_html_components_and_http_client.vk: Auto-escapedlib/htmlcomponents,lib/template,web/page+gzip, and loopback requests vianet/client.examples/27_tooling_fmt_lsp_and_v2vk.vk: Exercisesveko fmt, a liveveko lspJSON-RPC 2.0 session, andveko v2vksource migration.examples/28_simd_optimization_and_arm64_cross_compile.vk: Exercises hardwaref64/sqrt, SIMDbytes/{eq,index-of,xor,xor!,aes-enc-block}, and cross-compiles standalonelinux-arm64ELF64 andmacos-arm64Mach-O binaries.examples/29_async_reactor_http_server_and_client.vk: Exerciseslib/reactor.vk(epoll/kqueue/IOCP+WSAPoll), monotonic timers, cross-thread wakeups,web/serve-reactor, and concurrentnet/client/request-batch.examples/30_tui_and_native_ui_canvas.vk: Exercises double-buffered TrueColorlib/tui.vk, zero-copy RGBA32lib/ui/canvas.vk+lib/ui/widgets.vk,.uiwindow presentation, and 24-bit BMP export.examples/31_opt_in_ffi_and_c_struct_packing.vk: Demonstrates opt-in--allow-ffidynamic shared library calls (kernel32.dll/libc.so.6) and deterministic little-endian C-struct packing (lib/ffi.vk).examples/32_durable_objects_and_workflows.vk: Exercises crash-safedurable/objectactor turns, alarms, and FIFO inboxes alongside replay-safedurable/workflowsteps, retries, signals, and LIFO sagas overdb/kv.examples/38_zero_ffi_sqlite_and_orm.vk: Exercises genuine"SQLite format 3\0"4096-byte slotted B-tree pages,CREATE UNIQUE INDEX,BEGIN/ROLLBACK, SQL aggregates, and the homoiconic ORM (db/sqlite) across--vm,--wasm --check-slabs, and--native.examples/39_debugger_coverage_and_fuzzing.vk: Exercisestesting/fuzz(fuzz-bytes,fuzz-block) with automatic delta-debugging counterexample shrinking alongsideveko test --coverageandveko debug.examples/40_sdk_https_registry_and_wayland.vk: Exercisesveko-lang.org+ decentralized HTTPS.vkpregistry resolution (pkg/lock),VEKO_LIB.ffisearch paths, and Linux Wayland (wl_shm+xdg_wm_base) wire framing (ui/wayland).
17c. Multi-Module Showcase Applications (demos/)
Beyond single-file examples, demos/ provides six complete multi-module applications demonstrating full-stack architecture across --vm, --wasm, and --native:
| Application | Modules | What It Demonstrates |
|---|---|---|
demos/widget_gallery/ |
model.vk, pages.vk, main.vk |
29-widget Light-Mode desktop UI gallery (ui/widgets, ui/layout, ui/font, image/png, ui), clipboard selection (Ctrl+A/Ctrl+C/Ctrl+V), Per-Monitor V2 Hi-DPI badge, live desktop mode (-- --live), and lossless PNG export. |
demos/taskflow_studio/ |
auth.vk, store.vk, ui_assets.vk, main.vk |
Role-separated Light/Dark web portal & admin console (/ui/auth, /ui/portal, /ui/admin), HS256 JWT + TOTP 2FA, durable/object customer wallets, durable/workflow order fulfillment + LIFO sagas, and live web/serve-reactor mode (-- --serve 8095). |
demos/canvas_workbench/ |
state.vk, views.vk, main.vk |
720x440 immediate-mode desktop GUI (ui/canvas, ui/widgets, ui) with 4 tabs (Topology, Sketch Pad, Durable db/kv Sprint Board, SHA-256 Frame Profiler), Light/Dark toggle, live 60 FPS -- --live / --gui window mode, and BMP export. |
demos/pulse_mesh/ |
wire_frame.vk, mesh_broker.vk, tui_inspector.vk, main.vk |
Multi-protocol broker combining 'VKPM' binary frames (codec/wire + deflate + crc32 + Ed25519 tickets), TCP pub/sub, UDP gossip heartbeats, RFC 6455 WebSocket frames, HTTP upstream probes, homoiconic parse-block routes, and TrueColor tui inspector. |
demos/vault_dialect/ |
policy.vk, vault_core.vk, main.vk |
Structured cli flags, homoiconic parse-block RBAC dialect, NIST ML-KEM-768 + ML-DSA-65, and AES-256-GCM db/kv/put-sealed scoped zeroization. |
demos/netpulse_tui/ |
main.vk |
Compact health-probe monitor combining web/serve-async, net/client/get-many, tui, and a 320x160 RGBA32 ui/canvas telemetry card. |
18. Three-Backend Parity & Self-Hosting Convergence (S1 == S2)
The unified 46-module pure-Veko single-binary SDK in src/ (embedding all 93 lib/ standard library modules via src/stdlib_vfs.bin) compiles itself across Windows x86_64 (dist/bin/veko.exe PE32+), Windows 11 ARM64 (--target=win-arm64 PE32+ 0xAA64), Linux x86_64 (dist/bin/veko static ELF64), Linux AArch64 (--target=linux-arm64 static ELF64), macOS Apple Silicon (--target=macos-arm64 signed 16 KiB Mach-O), Wasm 3.0 (veko.wasm), and 64-bit VKO bytecode (veko.vko), proving byte-for-byte S1 == S2 native fixed-point convergence across x86_64 and AArch64.
Part XIII: Administrator & Security Governance Guide
Operational guidance for building, verifying, configuring, and governing Veko 1.0 workloads across local 64-bit VKO VM deployments (oro_vm.vk), vvm WebAssembly 3.0 zero-trust sandboxes (codegen.vk), and standalone native executables (native_emit.vk & arm64_emit.vk across win-x64, win-arm64, linux-x64, linux-arm64, and macos-arm64).
Defense-in-Depth Capability Gates, .secret Firewall & Supply-Chain Trust
Compile-time allow-caps enforcement, cryptographic taint tracking, zero-trust Wasm sandboxes, and signed VKP1 packages.
1. Build & Verification Pipeline
Veko ships with a pure-.vk build orchestrator (build.vk) that enforces static checks, multi-suite verification, documentation hygiene, and S1 == S2 self-hosting convergence:
| Command / Target | Action | Purpose |
|---|---|---|
check (veko run build.vk -- check) |
Static DAG check | Validates all 76 compiler/runtime modules (src/main.vk) and strict-typed examples |
test (veko run tests/run_tests.vk) |
Runs 18 test suites | Validates lexer, Pratt parser, types/secrets, 64-bit VKO, stdlib, PQC, TLS 1.3, reactor, durable workflows, UI/X11/clipboard/FFI, flamegraphs, veko.lock, and 3-track parity |
docs (veko docs) |
Compiles dist/docs/ |
Renders isolated End-User and Technical HTML suites + interactive SVG diagrams + hygiene checks |
build (veko run build.vk -- build) |
Builds binary + docs | Refreshes HTML docs and compiles a 2-stage S1 == S2 native veko binary into dist/bin/ |
fixed-point |
Fixed-point gate | Verifies byte-for-byte S1 == S2 convergence for native machine code and 64-bit VKO |
all (veko run build.vk -- all) |
Full release gate | Runs check, test, docs, and build sequentially |
2. Three-Backend Operational Profiles
Operators select among Veko's three execution tracks depending on trust boundary, portability, and deployment target:
- Track A — 64-Bit
VKOBytecode VM (oro_vm.vk/--vm/.vko): Fast local tooling, interactiveveko repl, doctests, dynamiceval, and precompiled 64-bitVKOexecution with runtime--allow-*capability flags. - Track B — WebAssembly 3.0 Sandbox (
codegen.vk/--wasm/vvm): Zero-trust execution for untrusted plugins and multi-tenant workloads insidevvm'sHostSandbox, enforcing--fuel,--mem-pages,--allow-fs=<dir>,--allow-hosts, SSRF blocking, and strict.ffiprohibition. - Track C — Native x86_64 & AArch64 (
native_emit.vk+arm64_emit.vk/--native): Standalone Windows PE32+ (--target=win-x64&--target=win-arm640xAA64, optional--gui), static zero-libcLinux ELF64 (--target=linux-x64&--target=linux-arm64), and ad-hoc SHA-256 signed 16 KiB Apple Silicon Mach-O (--target=macos-arm64) binaries with CPUIDAVX2/SSE2/AES-NI, OS-native readiness reactors (epoll/kqueue/IOCP), and opt-in.ffishared library trampolines.
| Operational Dimension | Track A: 64-Bit VKO VM (--vm) |
Track B: vvm Wasm 3.0 (--wasm) |
Track C: Native x86_64 & ARM64 (--native) |
|---|---|---|---|
| Trust Boundary | Trusted local CLI scripts, tools, and interactive REPL | Untrusted plugins, multi-tenant edge rules, and sandboxed tasks | Trusted standalone OS executables (zero external compiler, JVM, or GC) |
| Host Interface | Guarded VmPolicy OS PAL (fs, net, reactor, offscreen ui) |
WASI 0.3 + explicit HostSandbox capability allowlists (.ffi forbidden) |
Win32 IAT (win-x64/win-arm64), direct Linux syscalls (linux-x64/linux-arm64), or libSystem (macos-arm64) |
| Resource Metering | --fuel=<n> instruction quota + VmPolicy sleep/output caps + deterministic ORO cleanup |
vvm --fuel budget + --mem-pages ceiling + --check-slabs leak gate |
Thread-local 12-bucket ORO slab free-lists + deterministic .secret zero-wipe |
| Supply Chain | Verifies veko.vk trust-keys on .vkp bundles |
Verifies veko.vk trust-keys on .vkp bundles |
Verifies veko.vk trust-keys + emits SHA-256 LC_CODE_SIGNATURE on macos-arm64 |
3. Security, Capability & Secret Governance
Project Manifest Confinement (veko.vk)
Across all three backends, operators enforce static build-time confinement via veko.vk:
- Canonical Path Confinement: Project
rootand every resolved.vk/.vkomodule path are verified via canonicalreal-pathcontainment so symlink and../escapes are rejected before parsing. - Least-Privilege Capability Allowlisting (
allow-caps):.fs— Filesystem access (os/read-*,os/write-*,os/open,os/pread,os/pwrite,os/stat, etc.).clocks— Wall/monotonic clocks and sleeps (time/*).env— Environment variables and CLI args (os/getenv,os/args).net— TCP/UDP sockets, DNS, HTTP, and readiness reactor (net/*,http/*).exec— Child process execution (os/exec).ui— Native window surfaces (ui/*; Win32user32.dll/gdi32.dllimported only when used).ffi— Foreign C-ABI shared libraries (ffi/*; denied by default unlessallow-caps = [.ffi]or--allow-ffiis set; strictly forbidden on--wasm)
- Signed
'VKP1'Package Pinning (trust-keys): Pinningtrust-keys = ['ed25519:<hex>', 'mldsa65:<hex>']insideveko.vkensures every.vkpdependency is Merkle-verified against trusted publisher keys before loading.
Sensitive Buffer Zeroization & .secret Firewall
Unlike garbage-collected runtimes where keys linger in uncollected heap pages:
- No SSO Escape + Volatile Zero-Wipe: Values from
os/getenv/secretandbytes/with-secretalways allocateflag_secretheap slabs whose full capacity is overwritten with zeroes before returning to any free-list. - Automatic Redaction:
print,println,mold, andlog/*redact.secretvalues to<secret>. - Compile-Time & Runtime Sink Blocking: Deep taint checks block
.secretvalues from crossingnet/*,http/*,spawn,chan/send,json/encode,os/write-file,ui/present, andffi/*.
4. Troubleshooting & Diagnostics
| Symptom | Likely Cause | Operator Resolution |
|---|---|---|
unknown word 'n-1' |
Missing spaces around subtraction operator - |
Add spaces (n - 1); Veko treats n-1 as a kebab-case word |
capability error: ... requires .ffi |
Foreign library call without explicit FFI opt-in | Pass --allow-ffi or declare allow-caps = [.ffi] in veko.vk (native/VM only) |
docgen hygiene: decorative Unicode emoji |
Emoji character introduced into Markdown or HTML docs | Replace with plain text or inline vector SVG icon |
docgen hygiene: forbidden source ext |
Non-Veko source filename leaked into docs | Refer to pure-Veko modules (lexer.vk, parser.vk, oro_vm.vk, codegen.vk, native_emit.vk) |
veko inspect unexpected precedence |
Missing (...) around compound math passed to prefix word |
Wrap compound inline expressions as (offset + 4) |
Part XIV: CLI, Build & Syntax Reference
Complete reference for Veko CLI commands, build script targets, lexical tokens, numeric literals, Pratt operator precedence, and builtin arities.
1. CLI Commands
| Command | Status | Description |
|---|---|---|
veko <file.vk|file.vko|dir|.> [-- args...] |
Active | Zero-flag workspace or script shorthand (auto-honors veko.vk allow-caps) |
veko init [dir] [--cli|--web|--gui|--lib|--pkg|--strict|--agents|--ci|--sync] |
Active | Scaffold veko.vk + AGENTS.md, generate CI/Dockerfile (--ci), scaffold a .vkp package (--pkg), or sync allow-caps (--sync) |
veko doctor [--offline] [dir] |
Active | Audit toolchain tracks, embedded 95-module VKFS, VEKO_HOME / ~/.veko_modules, veko.vk & AGENTS.md, and registry reachability |
veko debug [--dap|-b <[file:]line>|--script=<s>] [file.vk] |
Active | Launch the interactive source debugger (s, n, f, c, bt, locals, p, <secret> redacted) or VS Code F5 DAP server |
veko test [--coverage[=<html]>|--lcov=<info>] [--vm|--wasm|--native] [file|dir]... |
Active | Discover and execute *_test.vk suites, --doctests, and Light-Mode HTML / LCOV line coverage reports |
veko bench [--save=<json>|--compare=<json>] [--runs=<n>] [--flamegraph[=<svg>]] [file|dir]... |
Active | Run *_bench.vk micro-benchmarks, save JSON baselines, diff regressions (FASTER/SLOWER), and emit SVG flamegraphs |
veko check [--strict-types] [--no-cache] [-A|-C <csv>|--allow-ffi] [file|dir] |
Active | Run gradual or strict type checking, exhaustive match & fallible /or checks, interface contracts, mut loans, capability auditing, and .secret taint verification |
veko run [--vm|--wasm|--native] [--fuel=<n>] [--profile[=<svg>]|--flamegraph[=<svg>]] [--watch] [-e <code>] [-A|-C <csv>] [file|dir] |
Active | Execute on 64-bit VKO VM (with optional --fuel quota, call-frame profiling & SVG flamegraph), Wasm 3.0 (vvm), or host-auto-detected cached AOT native |
veko build|compile [--native|--wasm|--vko] [--target=<t>] [--gui] [--no-cache] [file|dir] [-o out] |
Active | Tree-shaken compilation to native (win-x64, win-arm64, linux-x64, linux-arm64, macos-arm64), Wasm 3.0, or 64-bit VKO (with content-addressed mod_v1 cache) |
veko repl |
Active | Launch the interactive 64-bit VKO VM REPL (:help, :stats, :reset, :quit) |
veko doc [--html [--dir <d>]|--test|--json|--md] [-o out] [mod|file...] |
Active | Emit self-contained HTML API docs (with live Wasm 3.0 doctests & <canvas> previews), multi-page --dir, api.json, Markdown, or run doctests |
veko docs [out_dir] |
Active | Render End-User and Technical HTML documentation suites (default dist/docs) and enforce hygiene checks |
veko book [--cookbook|--html|--all] [out] |
Active | Compile Programming in Veko and The Veko Cookbook as single-page-cover EPUB 3.0 ebooks and full searchable multi-chapter HTML books |
veko bindgen <header_path> [-l <lib>] [-o <out.vk>] |
Active | Parse C ABI declarations and generate idiomatic Veko .ffi struct packers and function wrappers |
veko fmt [--check|--write|-w|--diff] <file.vk|dir>... |
Active | Format Veko source files canonically while preserving load-bearing [tight]/[spaced] tokens, strings, and comments |
veko lsp |
Active | Start the native JSON-RPC 2.0 Language Server (diagnostics, hover, definition, completion, document symbols, formatting, quick-fixes) |
veko go2vk|py2vk|rs2vk|v2vk <input> [-o out.vk] |
Active | Translate Go, Python, Rust, or V source into formatted Veko starter files with automatic stdlib/dependency mapping and TODO markers |
veko migrate [--from=go|py|rust|v] <input> [-o out.vk] |
Active | Unified migration driver (auto-detects language from file extension or explicit --from=) |
veko pkg <search|info|add|list|keygen|pack|index|verify|inspect|lock|fetch|verify-lock> |
Active | Search/inspect/install veko-lang.org .vkp packages, generate Ed25519 publisher keys, pack signed bundles, and build static HTTPS registry indexes |
veko inspect --tokens <file.vk> |
Active | Dump whitespace-aware lexer tokens (line:col and [tight]/[spaced] flags) |
veko inspect --ast <file.vk> |
Active | Dump the resolved two-pass Pratt AST and preserved RawBlocks |
veko inspect --bytecode <file.vk> |
Active | Disassemble compiled 64-bit VKO bytecode functions and constants |
veko inspect --modules <file.vk> |
Active | Audit the resolved dependency DAG, module file paths, exported symbols, and capability usage |
veko inspect --vko <file.vko> |
Active | Inspect 64-bit .vko header capabilities, exports, and disassembled VKO bytecode |
veko inspect --wasm <file.vk> |
Active | Compile to Wasm 3.0 and inspect module functions, globals, memory, and size |
veko version / veko help |
Active | Print toolchain version, backend summary, and command reference |
1a. Top-Level Compile Shorthands & Cross-Hosted Execution (src/main.vk)
The unified pure-Veko veko CLI (src/main.vk, 77 compiler modules + 95 embedded stdlib modules via 'VFS2' stdlib_vfs.vk) executes on Track A (.vko inside oro_vm.vk), Track B (.wasm inside vvm / WASI), and Track C (dist/bin/veko.exe win-x64 PE32+, win-arm64 PE32+ 0xAA64, dist/bin/veko static Linux ELF64, linux-arm64 static ELF64, or macos-arm64 Mach-O), accepting top-level compile flags (veko --native ..., veko --wasm ..., veko --vko ...) as shorthands for veko compile:
| Invocation | Description |
|---|---|
veko [--native|--wasm|--vko] [--target=<win-x64|win-arm64|linux-x64|linux-arm64|macos-arm64>] [--gui] <entry.vk> [-o <out>] |
Shorthand compile of a single file or modular DAG to any of the 5 native targets, WebAssembly 3.0 (.wasm), or 64-bit VKO bytecode (.vko) |
veko compile --native --target=win-arm64 <entry.vk> -o out.exe |
Cross-compile a standalone Windows 11 ARM64 PE32+ (0xAA64) executable from any host OS |
veko compile --native --target=linux-arm64 <entry.vk> -o out |
Cross-compile a static zero-libc Linux AArch64 ELF64 binary from any host OS |
veko compile --native --target=macos-arm64 <entry.vk> -o out |
Cross-compile a 16 KiB ad-hoc SHA-256 signed Apple Silicon Mach-O executable |
veko run --native <entry.vk> [-- args...] |
Compile once to dist/.veko_cache/<sha256> and execute at full native machine speed |
1b. Project Manifest (veko.vk) & Module Visibility
Place an optional homoiconic veko.vk manifest in your project directory to configure roots, dependencies, and capability limits:
{
name = 'edge-service'
root = 'src'
deps = { auth = '../shared-auth', stats = 'vendor/stats.vkp' }
allow-caps = [.fs .clocks .env .net]
trust-keys = ['ed25519:a1b2c3...']
}
pub&export: Modules are private by default; functions, macros, and struct schemas may be exported (pub Endpoint = struct { ... },pub encode = fn [x] [...], orexport [Endpoint encode decode-macro]). Mutable module globals cannot be exported.- Logical
usePaths: Import sibling, stdlib, or dependency modules cleanly (use [c = lib/codec, auth]); OS paths and.vksuffixes are forbidden in source imports. - Capability Audit: When
allow-capsis present,.fs,.clocks,.env,.net,.exec,.ui, and default-deny.ffiusage is verified transitively across the dependency graph before execution. - Signed
'VKP1'Bundle Trust (trust-keys): Anydepsentry ending in.vkpis cryptographically verified (SHA-256 Merkle root + Ed25519 and/or ML-DSA-65 signature) againsttrust-keysbefore module loading.
1c. Execution Backends Reference & Decision Matrix
| Backend | Purpose & Intended Workload | Runtime Mechanics | Notes |
|---|---|---|---|
Track A: oro_vm.vk (--vm / .vko) |
Instant script execution, veko repl, doctests, dynamic eval, and .vko distribution |
Fixed-width 64-bit VKO bytecode VM (op:u8 | flags:u8 | a:u16 | bx:u32) + zero-W^X superinstructions + VmPolicy PAL |
Supports runtime eval, gensym, and host http/fetch |
Track B: codegen.vk (--wasm / vvm) |
Zero-trust capability-confined plugins, fuel/memory quotas, and slab leak verification | Validated Wasm 3.0 (try_table, return_call, bulk memory, 12-bucket ORO RAM) in vvm HostSandbox + --check-slabs |
.ffi is strictly forbidden to preserve sandbox isolation |
Track C: native_emit.vk + arm64_emit.vk (--native) |
Standalone win-x64 & win-arm64 (0xAA64) PE32+ (--gui), linux-x64 & linux-arm64 static ELF64, and macos-arm64 Mach-O binaries |
Direct x86_64 (AVX2/SSE2/AES-NI) & AArch64 codegen, 79-group DCE, 12-bucket ORO slab free-lists, OS readiness reactors (epoll/kqueue/IOCP), DNS/TLS 1.3, .ui, and opt-in .ffi |
Omits dynamic string eval; use net/client + web for cross-track HTTP |
2. Build Orchestrator Targets (build.vk)
| Target | Invocation | Description |
|---|---|---|
all (default) |
veko run build.vk -- all |
Run check, test, docs, and 2-stage S1 == S2 native fixed-point dist/bin/veko build |
check |
veko run build.vk -- check |
Verify all 77 compiler modules (src/main.vk) and strict-typed examples |
test |
veko run tests/run_tests.vk |
Run all 18 pure-.vk automated verification suites |
docs |
veko docs |
Render dist/docs/user/ & dist/docs/technical/ + run hygiene gate |
build |
veko run build.vk -- build |
Render HTML docs and verify 2-stage native S1 == S2 fixed-point dist/bin/veko |
fixed-point |
veko run build.vk -- fixed-point |
Verify native machine code and 64-bit VKO bytecode fixed points |
help |
veko run build.vk -- help |
Print build orchestrator help |
3. Rich Literal Reference
| Category | Examples | Internal Representation |
|---|---|---|
| Integers | 42, -5, 0xff, 0b1010, 1_000 |
Signed i64 |
| Floats | 3.14, 0.25 |
IEEE-754 f64 |
| Durations | 100ns, 50us, 250ms, 5s, 2m, 1h |
i64 nanoseconds |
Byte Sizes (1024-based) |
64b, 4kb (4096), 16mb, 1gb, 4kib, 16mib, 1gib |
i64 bytes (1024^n) |
| Strings | 'hello\n', 'C:\\path' |
UTF-8 (\n, \r, \t, \\, \', \0) |
| Enums / Symbols | .tcp, .ip, .denied (must be spaced/after opener) |
Interned enum_lit |
4. Pratt Operator Precedence Table
Whitespace Disambiguation & Two-Pass Pratt Homoiconic Engine
How [tight] vs [spaced] tokens let kebab-case prefix calls coexist cleanly with infix math, UFCS chains, and macros.
| Binding Power | Category | Operators / Forms | Notes |
|---|---|---|---|
| 80 | Postfix (tight) | x.field, s.trim, table[i], buf[0..n] |
Requires tight == true (no leading whitespace) |
| 70 | Prefix & Unary | -x, not x, word arg1 ... argN, mut x |
Binds tighter than arithmetic and comparisons |
| 60 | Multiplicative / Shift / Mask | *, /, %, <<, >>, >>>, & |
Spaced / is divide; tight / is path; >>> is logical unsigned shift |
| 50 | Additive / Bitwise | +, -, ^, | |
Spaced - is subtract; tight - is kebab-case |
| 40 | Range | .., ..= |
Half-open or inclusive range |
| 30 | Comparison | ==, !=, <, <=, >, >= |
Terminates prefix word arguments cleanly |
| 20 | Logical | and, or |
Short-circuiting boolean logic |
| 10 | Pipe | lhs \ word arg2 ... argN |
Injects lhs as first argument; spans newlines |
| 0 | Statements & Control | =, def, use, if, unless, while, forever, defer, with, match, return |
Top-level and block statements |
5. Builtin Word Arities & Backend Coverage
| Word / Path | Base Arity | Backend Coverage | Notes |
|---|---|---|---|
print, println, len, empty?, zero?, even?, odd?, not, hash, abs, pop, first, last, mold, err, err?, ok?, type-of, call, compose, compose/deep |
1 |
All 3 | Single-argument words across oro_vm.vk, codegen.vk, and --native |
eval |
1 |
VM only | Dynamic runtime evaluation (oro_vm.vk only) |
gensym |
1 |
VM + Wasm | Unique symbol generation (oro_vm.vk + codegen.vk) |
min, max, add, sub, filter, map, each, push, parse-block |
2 |
All 3 | Two-argument words (\ pipe supplies arg 1) |
put, reduce, map/set, block/set, bytes/set, bytes/set-{u16,u32,i64}-{le,be} |
3 |
All 3 | O(1) in-place or CoW update (put mut obj .field val / put mut xs idx val) |
map/keys, block/with-cap, bytes/zeroize!, os/exists?, os/real-path, os/stat, os/read-dir, os/mkdir, os/remove, os/close, os/fsync, net/resolve |
1 |
All 3 | Core map, slab, filesystem, and DNS resolution builtins |
map/get, map/has?, map/delete, str/contains?, str/byte-at, bytes/fill, bytes/{get,push}-{u16,u32,i64}-{le,be}, os/open, os/rename, os/truncate, os/exec |
2 |
All 3 | Add +1 per /refinement (/or [fallback]); os/exec requires .exec |
os/pread, os/pwrite |
3 |
All 3 | (fd, buf_or_len, offset) positioned crash-safe file I/O (.fs gated) |
str/trim, str/upper, str/lower, str/from-bytes, str/to-i64, str/to-f64, as-u8, as-i64, as-f64, bytes/with-cap, bytes/with-secret, random/bytes, json/decode, json/encode, os/getenv, os/getenv/secret, os/read-file, net/accept, net/addr, net/close |
1 |
All 3 | Add +1 per /refinement (e.g. /or [fallback]) |
str/append, str/join, str/split, str/index-of, struct/with, bytes/push, bytes/push-all, bytes/append, bytes/copy-into, os/write-file, net/listen-tcp, net/connect-tcp, net/read-bytes, net/read-into, net/write, net/write-string, net/udp-bind, net/udp-recv-from, chan/send, json/get |
2 |
All 3 | Add +1 per /refinement (/timeout, /nonblock, /backlog, /or) |
net/udp-send-to |
4 |
All 3 | (sock, host, port, payload) UDP datagram transmit (.net gated) |
net/http/fetch, http/fetch (1); http/request, net/http/request (3) |
1 / 3 |
VM + Wasm | Host HTTP helpers; for 3-backend HTTP use pure-.vk net/client and web |
chan/new, chan/recv, chan/try-recv, chan/close, chan/select, task/await |
1 |
All 3 | Add +1 for /timeout and +1 for /or |
spawn |
1 |
All 3 | Control block spawning an isolated worker returning a task ID |
f64/sqrt |
1 |
All 3 | Hardware IEEE-754 square root (SQRTSD / FSQRT / f64.sqrt) |
bytes/eq, bytes/index-of, bytes/xor, bytes/xor!, bytes/aes-enc-block |
2 |
All 3 | Bulk SIMD / hardware-accelerated (AVX2/SSE2/AES-NI on x86_64) |
net/poll-new (0), net/poll-wake/poll-close/sock-error/try-accept (1), net/poll-wait/set-nonblock/connect-tcp/nonblock/try-write (2), net/try-read-into (3), net/poll-ctl (5) |
0..5 |
All 3 | OS-native readiness reactor PAL (epoll / kqueue / IOCP+WSAPoll / WASI net-poll); .net gated |
ui/open (3), ui/poll-events (1), ui/present (4), ui/close (1), ui/clipboard-get (0), ui/clipboard-get/secret (0), ui/clipboard-set (1), ui/dpi-scale (1) |
0..4 |
All 3 | Curated .ui window, clipboard (.secret-firewalled), and Hi-DPI PAL (lib/ui.vk wrapper recommended) |
ffi/open (1), ffi/sym (2), ffi/call (2), ffi/close (1) |
1..2 |
Native + VM | Opt-in .ffi C-ABI foreign library PAL (lib/ffi.vk); forbidden on --wasm |
time/now, time/unix, os/args, os/cwd, os/temp-dir |
0 |
All 3 | Zero-argument clock and process environment reads |
6. Coding-Agent & LLM Language Quick Reference (Constructs & Pitfalls)
Because Veko uses fixed-arity prefix words with spaced infix arithmetic instead of C/Python function parentheses, review these five rules and canonical patterns before writing .vk modules (see also the root AGENTS.md file):
Core Grammar Rules
- No Call Parentheses or Commas: Call words left-to-right (
os/write-file path data). Use(...)only to group nested subexpressions inside math or arguments (while i < (len hkeys) [ ... ],bytes/with-cap ((len head_b) + blen)). - Spaced Binary
-and/: Writen - 1anda / bwith spaces;n-1is a single kebab-case word anda/bis a module/refinement path. - Tight
.fieldand[i]; Spaced.enum: Field chains and indices allow no space before.or[(peer.host,raw.trim.upper,buf[0..n]); standalone enum tags require leading space or an opener (mode = .tls,return .ok). - Delimiters:
[ ... ]wraps code blocks, parameter lists, data lists, and slices;{ ... }wrapsstructdefinitions,structliterals, and maps;'...'wraps UTF-8 strings;//starts comments. - Two-Sided
mut: Mark mutable bindings withmutand annotate in-place parameter mutations on both signature (fn [mut buf bytes]) and call site (append-nl mut pkt).
Construct Examples at a Glance
use [h = net/http, j = json]
pub Endpoint = struct { host str, port i64 = 443, key secret str = '' }
pub build-ep = fn [host str] Endpoint [
ep = Endpoint { host = host }
ep \ struct/with { port = 8443 }
]
fetch-safe = fn [url str] [
defer [ print 'cleanup' ]
raw = h/fetch/timeout/or url 3s [ return (err 'fetch timeout') ]
raw \ j/decode
]
ch = chan/new 4
t = spawn [
chan/send ch 'ok'
1
]
status = chan/recv/or ch [ 'closed' ]
code = task/await t
Habit-Correction Table (From C / Python / Go / Rust)
| Common Habit | Avoid | Use in Veko |
|---|---|---|
| Call parens | len(xs), min(a, b) |
(len xs), (min a b) |
| Tight subtraction / division | n-1, total/count |
n - 1, total / count |
| Method call with args | xs.push(v) |
push mut xs v |
Omitted call-site mut |
push xs v |
push mut xs v |
| Double quotes | "hello" |
'hello' |
try/catch blocks |
try { ... } catch |
op/or args [ fallback ] |
When debugging unfamiliar syntax, run veko inspect --tokens file.vk to verify [tight] vs [spaced] lexing, then validate with veko check --strict-types file.vk.