Documentation
Everything you need to write Zym scripts and embed Zym into your projects.
Getting Started
Language Guide
Variables, functions, control flow, structs, enums, memory semantics — the complete syntax and feature tour.
Embedding Guide
VM lifecycle, native functions, two-way FFI, value system — integrate Zym into your C/C++ project.
Language Semantics
Deep-dive documentation for each language feature — full syntax, edge cases, and patterns.
Control Flow
Conditionals, while/do-while/for loops, break & continue, goto/labels, state machines, and jump tables.
Functions
Named functions, hoisting, overloading by arity, anonymous & arrow functions, closures, and dispatchers.
Memory Semantics
ref (aliasing), val (deep copy), slot (rebinding), clone (true isolation), and ref flattening.
Structs & Enums
Struct declaration, positional/named init, nested structs, schema hoisting; enum variants, type safety, and scoping.
Tail-Call Optimization
The @tco directive, modes (aggressive/safe/smart/off), mutual recursion, accordion & shattered patterns.
Spread Operator
List spread, map spread, struct spread, override ordering, and function argument spreading.
Core Modules
Built-in functions registered automatically at VM startup.
Strings
UTF-8 string queries and manipulation — length, slice, replace, split, pad, trim, and more.
Math
Rounding, powers, trig, logarithms, interpolation, type checks — wrapping the C standard math library.
Lists
Create, query, and mutate ordered collections — push, pop, sort, slice, reverse, and more.
Maps
Key-value dictionaries with string keys — size, keys, values, entries, merge, and null-deletion.
Conversions
Type conversion between strings, numbers, and formatted output with str() and num().
Error Handling
Runtime errors and assertions with error() and assert().
Advanced
Garbage Collection
Script-level GC control — pause, resume, force cycles, monitor memory, and tune thresholds.
Continuations & Preemption
Delimited continuations, fibers, generators, algebraic effects, and preemptive scheduling.
Macros & Preprocessor
Compile-time macros, function-like macros, multi-line block macros, conditional compilation, and expression evaluation.
Modules
File-based module system — import(), default caching (singleton), "use fresh" directive, named imports, path resolution, and circular detection.