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.