veko
ORO Homoiconic Language • Custom VM • Wasm 3.0 (vvm) • Native x86_64 & arm64

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:

VEKO
{
  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] [...], or export [Endpoint encode decode-macro]). Mutable module globals cannot be exported.
  • Logical use Paths: Import sibling, stdlib, or dependency modules cleanly (use [c = lib/codec, auth]); OS paths and .vk suffixes are forbidden in source imports.
  • Capability Audit: When allow-caps is present, .fs, .clocks, .env, .net, .exec, .ui, and default-deny .ffi usage is verified transitively across the dependency graph before execution.
  • Signed 'VKP1' Bundle Trust (trust-keys): Any deps entry ending in .vkp is cryptographically verified (SHA-256 Merkle root + Ed25519 and/or ML-DSA-65 signature) against trust-keys before 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

SYNTAX & HOMOICONICITY

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.

Interactive SVG • Click any node (6 components)
LEXICAL DISAMBIGUATION lexer.vk TWO-PASS PRATT ENGINE parser.vk HOMOICONIC EVALUATION macro_eval.vk + lib/dialect.vk Token stream Typed literals Arity table AST + RawBlock Block values Lexer 4 Whitespace Rules [tight] vs [spaced] bits Lexer First-Class Literals 5s, 64kb, 0xFF, '...' Parser Pass 1 Pass 1: Signature Scan fn / struct / def / use Parser Pass 2 Pass 2: Pratt Precedence BP 80 postfix .. BP 10 pipe Homoiconicity quote & compose Code-as-Data Templates Dialects parse-block Dialects Embedded Domain Grammars
Components:
Lexer
4 Whitespace Rules
lexer.vk
Component 1 of 6
Architectural Role & Purpose

Eliminates grammar ambiguity using single-character attachment flags.

Contextual Description & System Interaction

Inspect exact attachment flags anytime with veko inspect --tokens.

Core Functionality & Mechanics
  • n - 1 (subtraction) vs n-1 (kebab word) vs -1 (negative literal)
  • a / b (division) vs str/join (module path) vs /or (refinement)
  • buf[0..n] & s.trim (tight postfix) vs .tls (spaced enum)
Lexer
First-Class Literals
lexer.vk
Component 2 of 6
Architectural Role & Purpose

Parses human-readable durations, binary sizes, hex/binary ints, and UTF-8 strings.

Contextual Description & System Interaction

Eliminates magic numbers in network timeouts and buffer capacities.

Core Functionality & Mechanics
  • Durations scale to i64 nanoseconds (500ms, 3s, 2m)
  • Binary sizes scale by powers of 1024 (64b, 4kb, 16mb)
  • Single-quoted UTF-8 strings avoid JSON double-quote escaping
Parser Pass 1
Pass 1: Signature Scan
parser.vk
Component 3 of 6
Architectural Role & Purpose

Collects top-level function arities, refinements, structs, and module imports.

Contextual Description & System Interaction

Makes parentheseless prefix calls deterministic without forward declarations.

Core Functionality & Mechanics
  • Enables order-independent top-level mutually recursive functions
  • Computes exact call arity (+1 for /or or value refinements)
  • Registers macro definitions before Pass 2 expression parsing
Parser Pass 2
Pass 2: Pratt Precedence
parser.vk
Component 4 of 6
Architectural Role & Purpose

Binds tight postfix chains, prefix word arguments, infix math, comparisons, and \ pipes.

Contextual Description & System Interaction

Ensures expressions like a + b == c and raw \ json/decode read naturally.

Core Functionality & Mechanics
  • BP 80: tight .field, .ufcs, and [idx] / [lo..hi] slicing
  • BP 60..30: * / % >>> & then + - | ^ then == != < <= > >=
  • BP 10: left-to-right \ pipe feeds result as arg 1 of next word
Homoiconicity
quote & compose
macro_eval.vk
Component 5 of 6
Architectural Role & Purpose

Treats [ ... ] blocks as inspectable values and splices computed expressions cleanly.

Contextual Description & System Interaction

Delivers Lisp-grade metaprogramming without parentheses or backtick clutter.

Core Functionality & Mechanics
  • quote [ ... ] returns unevaluated token/value blocks
  • compose evaluates only parenthesized (expr) slots
  • macro transforms raw argument blocks at compile time
Dialects
parse-block Dialects
parser.vk lib/dialect.vk
Component 6 of 6
Architectural Role & Purpose

Matches typed pattern rules over homoiconic blocks to drive custom DSLs.

Contextual Description & System Interaction

Lets teams craft readable domain dialects without writing external parsers.

Core Functionality & Mechanics
  • Matches literals, typed captures, enums, and nested sub-blocks
  • Powers firewall rules, SQL-like queries, and vault ACL policies
  • Runs identically on VM, Wasm 3.0, and Native binaries
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

  1. 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)).
  2. Spaced Binary - and /: Write n - 1 and a / b with spaces; n-1 is a single kebab-case word and a/b is a module/refinement path.
  3. Tight .field and [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).
  4. Delimiters: [ ... ] wraps code blocks, parameter lists, data lists, and slices; { ... } wraps struct definitions, struct literals, and maps; '...' wraps UTF-8 strings; // starts comments.
  5. Two-Sided mut: Mark mutable bindings with mut and annotate in-place parameter mutations on both signature (fn [mut buf bytes]) and call site (append-nl mut pkt).

Construct Examples at a Glance

VEKO
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.