veko-lang.org
Download Free EPUB 3.0

Part V · Complete Tooling, CLI & Standard Library Reference

Appendix A

Complete CLI, Manifest, Precedence & Builtin Intrinsics Reference

Exhaustive command-line flags, veko.vk fields, literal formats, Pratt binding powers, and builtin word arities

Complete reference for Veko CLI commands, build script targets, lexical tokens, numeric literals, Pratt operator precedence, and builtin arities.


1. CLI Commands

CommandStatusDescription
veko <file.vk|file.vko|dir|.> [-- args...]ActiveZero-flag workspace or script shorthand (auto-honors veko.vk allow-caps)
veko init [dir] [--cli|--web|--gui|--lib|--pkg|--strict|--agents|--ci|--sync]ActiveScaffold veko.vk + AGENTS.md, generate CI/Dockerfile (--ci), scaffold a .vkp package (--pkg), or sync allow-caps (--sync)
veko doctor [--offline] [dir]ActiveAudit 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]ActiveLaunch 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]...ActiveDiscover 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]...ActiveRun *_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]ActiveRun 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]ActiveExecute 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]ActiveTree-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 replActiveLaunch the interactive 64-bit VKO VM REPL (:help, :stats, :reset, :quit)
veko doc [--html [--dir <d>]|--test|--json|--md] [-o out] [mod|file...]ActiveEmit 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]ActiveRender End-User and Technical HTML documentation suites (default dist/docs) and enforce hygiene checks
veko book [--cookbook|--html|--all] [out]ActiveCompile 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>]ActiveParse C ABI declarations and generate idiomatic Veko .ffi struct packers and function wrappers
veko fmt [--check|--write|-w|--diff] <file.vk|dir>...ActiveFormat Veko source files canonically while preserving load-bearing [tight]/[spaced] tokens, strings, and comments
veko lspActiveStart 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]ActiveTranslate 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]ActiveUnified 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>ActiveSearch/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>ActiveDump whitespace-aware lexer tokens (line:col and [tight]/[spaced] flags)
veko inspect --ast <file.vk>ActiveDump the resolved two-pass Pratt AST and preserved RawBlocks
veko inspect --bytecode <file.vk>ActiveDisassemble compiled 64-bit VKO bytecode functions and constants
veko inspect --modules <file.vk>ActiveAudit the resolved dependency DAG, module file paths, exported symbols, and capability usage
veko inspect --vko <file.vko>ActiveInspect 64-bit .vko header capabilities, exports, and disassembled VKO bytecode
veko inspect --wasm <file.vk>ActiveCompile to Wasm 3.0 and inspect module functions, globals, memory, and size
veko version / veko helpActivePrint 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:

InvocationDescription
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.exeCross-compile a standalone Windows 11 ARM64 PE32+ (0xAA64) executable from any host OS
veko compile --native --target=linux-arm64 <entry.vk> -o outCross-compile a static zero-libc Linux AArch64 ELF64 binary from any host OS
veko compile --native --target=macos-arm64 <entry.vk> -o outCross-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

BackendPurpose & Intended WorkloadRuntime MechanicsNotes
Track A: oro_vm.vk (--vm / .vko)Instant script execution, veko repl, doctests, dynamic eval, and .vko distributionFixed-width 64-bit VKO bytecode VM (op:u8 | flags:u8 | a:u16 | bx:u32) + zero-W^X superinstructions + VmPolicy PALSupports runtime eval, gensym, and host http/fetch
Track B: codegen.vk (--wasm / vvm)Zero-trust capability-confined plugins, fuel/memory quotas, and slab leak verificationValidated 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 binariesDirect 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 .ffiOmits dynamic string eval; use net/client + web for cross-track HTTP

2. Build Orchestrator Targets (build.vk)

TargetInvocationDescription
all (default)veko run build.vk -- allRun check, test, docs, and 2-stage S1 == S2 native fixed-point dist/bin/veko build
checkveko run build.vk -- checkVerify all 77 compiler modules (src/main.vk) and strict-typed examples
testveko run tests/run_tests.vkRun all 18 pure-.vk automated verification suites
docsveko docsRender dist/docs/user/ & dist/docs/technical/ + run hygiene gate
buildveko run build.vk -- buildRender HTML docs and verify 2-stage native S1 == S2 fixed-point dist/bin/veko
fixed-pointveko run build.vk -- fixed-pointVerify native machine code and 64-bit VKO bytecode fixed points
helpveko run build.vk -- helpPrint build orchestrator help

3. Rich Literal Reference

CategoryExamplesInternal Representation
Integers42, -5, 0xff, 0b1010, 1_000Signed i64
Floats3.14, 0.25IEEE-754 f64
Durations100ns, 50us, 250ms, 5s, 2m, 1hi64 nanoseconds
Byte Sizes (1024-based)64b, 4kb (4096), 16mb, 1gb, 4kib, 16mib, 1gibi64 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.

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 Lexer4 Whitespace Rules[tight] vs [spaced] bits LexerFirst-Class Literals5s, 64kb, 0xFF, '...' Parser Pass 1Pass 1: Signature Scanfn / struct / def / use Parser Pass 2Pass 2: Pratt PrecedenceBP 80 postfix .. BP 10 pipe Homoiconicityquote & composeCode-as-Data Templates Dialectsparse-block DialectsEmbedded Domain Grammars
Component & ModuleArchitectural Role
4 Whitespace Rules
lexer.vk
Eliminates grammar ambiguity using single-character attachment flags.
First-Class Literals
lexer.vk
Parses human-readable durations, binary sizes, hex/binary ints, and UTF-8 strings.
Pass 1: Signature Scan
parser.vk
Collects top-level function arities, refinements, structs, and module imports.
Pass 2: Pratt Precedence
parser.vk
Binds tight postfix chains, prefix word arguments, infix math, comparisons, and \ pipes.
quote & compose
macro_eval.vk
Treats [ ... ] blocks as inspectable values and splices computed expressions cleanly.
parse-block Dialects
parser.vk + lib/dialect.vk
Matches typed pattern rules over homoiconic blocks to drive custom DSLs.
Binding PowerCategoryOperators / FormsNotes
80Postfix (tight)x.field, s.trim, table[i], buf[0..n]Requires tight == true (no leading whitespace)
70Prefix & Unary-x, not x, word arg1 ... argN, mut xBinds tighter than arithmetic and comparisons
60Multiplicative / Shift / Mask*, /, %, <<, >>, >>>, &Spaced / is divide; tight / is path; >>> is logical unsigned shift
50Additive / Bitwise+, -, ^, |Spaced - is subtract; tight - is kebab-case
40Range.., ..=Half-open or inclusive range
30Comparison==, !=, <, <=, >, >=Terminates prefix word arguments cleanly
20Logicaland, orShort-circuiting boolean logic
10Pipelhs \ word arg2 ... argNInjects lhs as first argument; spans newlines
0Statements & Control=, def, use, if, unless, while, forever, defer, with, match, returnTop-level and block statements

5. Builtin Word Arities & Backend Coverage

Word / PathBase ArityBackend CoverageNotes
print, println, len, empty?, zero?, even?, odd?, not, hash, abs, pop, first, last, mold, err, err?, ok?, type-of, call, compose, compose/deep1All 3Single-argument words across oro_vm.vk, codegen.vk, and --native
eval1VM onlyDynamic runtime evaluation (oro_vm.vk only)
gensym1VM + WasmUnique symbol generation (oro_vm.vk + codegen.vk)
min, max, add, sub, filter, map, each, push, parse-block2All 3Two-argument words (\ pipe supplies arg 1)
put, reduce, map/set, block/set, bytes/set, bytes/set-{u16,u32,i64}-{le,be}3All 3O(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/resolve1All 3Core 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/exec2All 3Add +1 per /refinement (/or [fallback]); os/exec requires .exec
os/pread, os/pwrite3All 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/close1All 3Add +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/get2All 3Add +1 per /refinement (/timeout, /nonblock, /backlog, /or)
net/udp-send-to4All 3(sock, host, port, payload) UDP datagram transmit (.net gated)
net/http/fetch, http/fetch (1); http/request, net/http/request (3)1 / 3VM + WasmHost 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/await1All 3Add +1 for /timeout and +1 for /or
spawn1All 3Control block spawning an isolated worker returning a task ID
f64/sqrt1All 3Hardware IEEE-754 square root (SQRTSD / FSQRT / f64.sqrt)
bytes/eq, bytes/index-of, bytes/xor, bytes/xor!, bytes/aes-enc-block2All 3Bulk 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..5All 3OS-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..4All 3Curated .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..2Native + VMOpt-in .ffi C-ABI foreign library PAL (lib/ffi.vk); forbidden on --wasm
time/now, time/unix, os/args, os/cwd, os/temp-dir0All 3Zero-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 HabitAvoidUse in Veko
Call parenslen(xs), min(a, b)(len xs), (min a b)
Tight subtraction / divisionn-1, total/countn - 1, total / count
Method call with argsxs.push(v)push mut xs v
Omitted call-site mutpush xs vpush mut xs v
Double quotes"hello"'hello'
try/catch blockstry { ... } catchop/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.