MoxyMoxy
Docs contents

Roadmap

Moxy's position: TypeScript for C. A superset you can adopt one file at a time inside an existing C codebase, that compiles to C you can read, and that removes the busywork of strings, collections, tagged unions, errors and memory. Rust owns "safe", Zig owns "explicit control". Moxy wins on adoption cost, and every item below is judged against that.

Rules for the whole roadmap:

  • Never promise safety Moxy doesn't deliver. Every claim in the docs has a test behind it.
  • Every phase ends with the benchmark suite run and published, including the numbers Moxy loses.
  • The compiler stays fast: compiling the compiler to C stays under 100 ms (57 ms at 0.3.1).
  • Generated C stays readable. A feature that needs unreadable output needs a reason.
  • Build output stays small. Every cache Moxy writes has a cap and an eviction rule (docs/book/architecture.md, "Disk budget"); moxy clean --cache removes all of it.

Status: [ ] not started, [~] in progress, [x] done.

Feature freeze (2026-12-01), reached the same day. Gates, async, actors, parallel helpers, richer patterns and tests in source have all landed. After that, no new syntax or semantics before 1.0: work goes to Phase 8, stability, production quality, performance and resource use.

Phase 0: stability

Bugs that make a first impression worse than any missing feature. All of these were reproduced against 0.3.1.

  • Release long ref struct chains without recursion. Dropping a 1,000,000-node linked list overflows the stack (exit 139); 100,000 nodes is fine. Use a worklist in mxy_obj_release.

  • Report null dereferences with a location instead of terminated by signal 11. Install SIGSEGV/SIGBUS handlers that print the faulting .mxy line when available, and exit 101 like a panic.

  • Make reading through a dead weak field a panic with a location, not a segfault. (Phase 1's optionals replace this with a compile-time check.)

  • Append in place when a string is uniquely owned. s = s + "x" in a loop is quadratic: 100,000 appends take 175 ms.

  • Document that git submodule update --init libs/goose is required before make, or fail with that command in the message (it already does; mention it in the README build steps).

  • Failed assert messages show the asserted expression and its operand values (assertion failed: x + 1 == 4 (left: 3, right: 4)) with the location. Today it prints the whole source line.

  • Self-compile back under 100 ms. moxy emit src/main.mxy takes 124 ms after methods, interfaces and reflection landed (the source grew from 16.8k to about 21k lines); per-line speed is unchanged, so this needs real profiling. Now 60 ms (lexer dispatch by first character, cached lookups, cheaper formatting); CI fails if it exceeds 2x the C lexer baseline.

  • moxy fmt breaks two patterns: a continuation line starting with a binary operator (+tmv.tm_hour) and a cast chain applied to &x ((u64)(uintptr_t)&x becomes (uintptr_t) & x). CI's formatting check fails until it is fixed.

  • Reserve the mxy_ prefix for the runtime: user functions named mxy_* get no prototype today and can collide with runtime names. Make them a compile error like globals, and give the standard library its own private prefix.

Phase 1: a language people can build libraries in

Generics and methods come first because the standard library, the memory work and the package ecosystem are all rewritten without them.

Generics

  • Generic structs and enums: struct Pair<A, B>, enum Option<T>.
  • Generic functions with inference at the call site: T first<T>(T[] xs).
  • Monomorphize: one C function or struct per instantiation, with readable mangled names (Pair__int__string).
  • Deduplicate instantiations across files so compile time and binary size stay flat.
  • Rebuild T[], map[K, V], Result and Future on generics. Built-ins and user types follow the same rules, and element copy/drop/eq/hash become direct calls instead of witness-table indirection. List, slice and map operations are generated per element type with direct copy/drop/eq/hash; rare paths (sort, keys, map for-in, fmt) stay type-erased. nbody went from 3.9x C to about 1.4x.

Methods and interfaces

  • Methods on structs, enums and ref structs, compiled to plain C functions (Point_len(Point *self)).
  • Interfaces resolved at compile time (interface Hash { uint64_t hash(); }), used as generic bounds.
  • Optional dynamic dispatch (dyn Hash) as an explicit vtable, only when asked for.

Null and errors

  • Optionals: T? for ref struct, weak reads and pointers returned from C. The compiler requires a check (if let, match, ??) before use. C pointers stay unchecked C, as the design decided; the optional --strict-pointers lint is not built.
  • Non-optional ref struct references by default once optionals land, with a migration warning period. A warning with a fix-it (compiler and language server) in 0.4; it becomes an error in 0.5. The same holds for reaching through a weak T field without a check (W0207, compiled as ! in 0.4) and for naming a variant of an enum without payloads bare (W0209), both of which 0.3 accepted.
  • Result<T, E> with typed errors; Result<T> stays as Result<T, string>.
  • ? to return an Err early, converting error types through an interface.

Data

  • Slices: a[1..3] gives a view that doesn't own or copy. Works on lists, strings and C arrays. Slicing a T[] parameter copies the list once (declare T[..] to avoid it).
  • Fixed-width integer names (i8…i64, u8…u64, usize) as aliases for <stdint.h> types.
  • Checked integer overflow in debug builds, wrapping in release, with explicit wrapping_add etc. checked_* waits for optionals; it is a compile error with a hint until then.

Pattern matching

  • Guards: n if n > 0 =>. The guard reads the bindings in place; one that needs temporaries runs into a flag first. Guarded arms never count toward exhaustiveness.
  • Several patterns in one arm: 1 | 2 =>, Circle(_) | Square(_) =>. Alternatives bind the same names at the same types; (A | B) is still a bitwise-or value.
  • Nested and struct patterns: Some(Point{ .x = 0, .y = y }) =>, enum payloads inside enums, literals inside payloads. Coverage uses the usefulness algorithm, so unreachable arms are found (a warning, W0208; the arm is left out) and missing cases are spelled out (missing Some(Err(_))).

Phase 2: memory model

Full design, measurements and rationale: docs/design/memory.md. Short version: keep automatic reference counting as the default, make most of it disappear at compile time, and add compiler-checked gates (arena blocks) for the code where allocation speed matters.

M1: cheaper objects (no language change)

  • Shrink the ref struct header from 40 to 16 bytes: one word for strong and weak counts, one pointer to a static type descriptor holding drop, fmt and the name. Binary-trees peak memory is 35 MB in Moxy vs 18.6 MB in C today. Done: 35.5 MB to 18.7 MB. Correction: the 18.6 MB "C" figure included a 16 MB arena by mistake. Plain C malloc peaks at 10.2 MB, so Moxy is 1.83x; a 16-byte header on 16-byte nodes puts the floor near 2x.
  • Iterative release (Phase 0) for objects, lists and maps.
  • Bench suite in bench/: binary-trees, n-body, word count, JSON round trip, a linked-list churn, and the compiler compiling itself. Each with a C baseline. Run in CI and fail on a regression above 5%. First results, ratio to C: binarytrees 1.31x, jsonroundtrip 1.91x, wordcount 2.96x, nbody 3.92x, listchurn 4.12x. The CI job has not run on GitHub yet.

M2: count less, count cheaper

  • Non-atomic reference counts by default. An atomic increment/decrement pair costs 13.3 ns on arm64 against 2.5 ns for a plain pair. A value becomes thread-shared, and switches to atomic counting, only when it crosses a thread boundary (Future arguments, results, captures, and anything reachable from them). The compiler knows every crossing point. Done: counts are plain until a value crosses into a future, a channel or a lock, where it and everything reachable from it are marked shared.
  • [~] Mark shared values lazily, at the first retain from another thread, so handing a large structure to a Future doesn't walk all of it up front. Marking happens at the crossing, not at the first foreign retain, and walks each value once; a large structure handed to a future is still walked up front.
  • Ownership inference (Perceus-style): the last use of a variable moves instead of retaining, and dead retain/release pairs are removed. Target: 90% of retain/release calls removed from the compiler's own generated C. Done: last-use moves, dead pair removal and interprocedural write effects. The 90% target on the compiler's own C turned out to be the wrong measure (it counts call sites, many of them in cold paths): sites went from 68 to 34 in the sampled functions, a test corpus lost 24% of its sites and 47% of its dynamic retains, and listchurn does 80% fewer count operations.
  • Reuse in place: when a uniquely owned value is released and a same-sized one is allocated in the same function, reuse the memory.
  • Borrow parameters across calls, extending the existing "callee retains only if it modifies" rule. Arguments read from a place another thread may change (a field of a shared ref struct, a global once threads start) are always retained.

M3: gates

  • gate { ... } blocks (named after, and shaped like, Objective-C's @autoreleasepool, but with arena semantics rather than deferred releases): every managed allocation inside comes from a bump arena, and the whole arena is freed in one step at the closing brace. C's version of binary-trees runs in 34 ms with an arena against 171 ms with malloc. The spec said reference counting would be switched off for gate objects; it was revised: retain and release still run on gate values, because copy-on-write and values held from outside the gate need exact counts. What goes is per-block freeing (nothing in a gate is freed one block at a time), and, while a gate holds nothing from outside itself, the walk of what a released value holds (drops are logged and dropped with the arena). Functions called inside a gate allocate in it. Gated binary-trees: 58 ms against 165 ms without the gate, 142 ms for C malloc and 39 ms for a C arena; gated jsonroundtrip 106 ms against 131 ms without, 108 ms for C malloc and 53 ms for a C arena (medians of 21 interleaved runs, load average 25 to 30 on a shared machine; design). A program with a gate anywhere pays about 10 to 18% in code outside its gates (the checks in retains, drops and stores).
  • Escape checking: a value leaving the gate (returned, stored outside, captured by a future) is copied out automatically into the normal heap, or rejected at compile time when copying isn't possible (ref struct identity). The compiler states which one it did. Stores into variables declared outside the gate and returns are resolved at compile time; stores into fields, elements, globals and through pointers are checked when they run, in every function of a program with gates, so callees need nothing special. A ref struct escaping through a callee panics with both locations. Copies go into the region they land in: the heap, or an enclosing gate. Async calls never allocate in a gate (their arguments are copied out), and a gate's cycles are collected as it closes under --cycles. Store checks only in functions reachable from a gate were considered and not built (indirect calls make the graph unsound or nearly everything; the checks aren't where the cost is).
  • Gate parameters for functions that allocate into the caller's gate (string[] tokens(string src) in gate). Revised: since the allocation target follows the thread, every function called in a gate already allocates in it and returns without a copy, so in gate is a checked contract rather than a new capability: its body is checked as if inside the caller's gate, a return from inside its own gate is an error, and async and Future functions can't be in gate.
  • Explicit arenas as values for C-style code that wants to hold one across calls. Arena a = Arena::new(); gate (a) { ... } (std/arena.mxy), with a.reset(), a.free() and release on the last reference; one block open at a time, use after free panics. Because escapes are copied out, nothing one block makes is reachable from the next: an arena controls when memory goes, it doesn't hold data across blocks (region-typed variables would; not designed).
  • [~] Debug builds poison freed arenas and check every gate pointer on load. The whole test suite runs this way, so a missed escape shows up as a panic, not a use-after-free. Closed gates' pages are made inaccessible (the newest 256 MB), so a load through an escaped pointer faults and is reported with the gate; pointers are also checked when kept or freed, but not on every load in software. An Arena's memory is poisoned at reset() and free(), not between its blocks. --gate-stress makes every function body a gate; make test runs tests/memory and tests/collections that way, and the whole suite passes under it except one test that checks sharing across a future (the future gets a copy) and the gate tests themselves.
  • Make copy-outs visible: moxy lint reports each one with its size class, and --explain-gates prints every escape decision.

M4: cycles and diagnostics

  • Static cycle check: warn when a ref struct type can reach itself through strong fields only, with a fix-it suggesting weak. One million two-node cycles leak 130 MB silently today. A field marked strong silences it; 0 warnings across the repo's own 15 ref struct types.
  • Debug-build leak report at exit: every live ref struct with its allocation site. Costs about 35% time and 40% memory on binary-trees in debug builds; release is unchanged.
  • unowned references for back-pointers that are known to outlive their holder, checked in debug builds.
  • Optional cycle collector (--cycles, trial deletion on ref struct only) if real programs still need it after the static check. Not before. Opt-in, with no change to programs built without it (same object code). A million two-node cycles: 63 MB leaked without, 3.9 MB peak with. Costs 16% on binarytrees and 23% on listchurn with the flag; shared objects are never collected. See docs/book/memory.md.

Checkpoint

Every M step keeps the self-compile budget (under 100 ms), checked in CI. After M2, publish the bench suite. If allocation-heavy benchmarks are still more than 1.5x their C malloc baseline, revisit the design before starting M3 (gates).

Result (2026-12-01, loaded machine): binarytrees 1.17x, listchurn 1.41x, jsonroundtrip 1.22x, wordcount 1.16x. The first run after M2 failed (wordcount 2.9x, jsonroundtrip 1.7x); the gap was integer formatting through vsnprintf and per-piece allocation in split, concatenation and join, not reference counting. Fixed without changing the benchmarks. Passed; M3 started.

Phase 3: prove the pitch

  • Port a well-known C program (or a module of one) to Moxy. Publish line counts, removed cleanup code, and speed before and after. cJSON: docs/port.md. The unchanged file compiles and passes cJSON's tests; the hand port drops all manual memory and error cleanup and about half the lines, and parses about 1.3x slower.
  • [~] Benchmarks page: the same programs in C, Moxy, Rust and Zig, with sources and the machine they ran on. docs/benchmarks.md exists with Rust and Zig versions, but its numbers were taken on a heavily loaded machine and before the compile-speed fix; regenerate on a quiet machine.
  • moxy build --target <triple> using zig cc as the C compiler when installed, for cross-compilation without a toolchain per target.
  • [~] Windows: MinGW and zig cc first, MSVC after. Add a Windows CI job. Everything compiles for x86_64-windows-gnu (mingw and zig cc) and make windows builds moxy.exe, but nothing has run on Windows yet; the windows-latest CI job will be the first run. MSVC is not supported.
  • Incremental adoption guide: adding Moxy to an existing Make, CMake or Meson project, file by file. Make and CMake tested; Meson untested.
  • moxy fix: since a .c file renamed to .mxy already compiles, offer mechanical modernizations on top: char * buffers to string, malloc/realloc arrays to T[], tag-plus-union to enum with match, goto cleanup to defer. Preview as a diff, apply with --write, never change behavior silently. On its test corpus 42 of 63 candidate sites were rewritten, the rest reported as suggestions; tagged unions are suggestion-only.

Phase 4: standard library

Built on generics, interfaces and slices. Each module has tests and runs under the sanitizers.

  • Compile-time reflection: static for f in T.fields { ... }, static if, value.[f], unrolled per type like generics (docs/design/language.md). Needed by std/json derive-style mapping and argument parsing, and lets libraries do what the compiler hard-codes for Eq, Hash and Format.
  • std/fs: directories, paths, metadata, walking. With std/path and a typed IoError. Windows uses the ANSI code page and is compile-checked only.
  • std/process: spawn, pipes, exit codes, environment. Windows is compile-checked only.
  • std/net: TCP, UDP, DNS.
  • std/http: a minimal client and server (grow from examples/webserver).
  • std/json: parse and emit, with derive-style struct mapping. Structs, ref structs, lists, maps, optionals and payload-free enums derive through reflection; enums with payloads need hand-written impls.
  • std/hash, std/rand, std/time (dates, durations, monotonic clocks), std/fmt. wyhash is not yet checked against upstream test vectors; Windows paths are compile-checked only.
  • std/sync: mutex, atomics, channels.
  • Collections beyond list and map: set, deque, heap, ordered map. No user-defined for-in yet, so they offer each() and to_list().

Phase 5: concurrency

  • A work-stealing thread pool behind Future, replacing one OS thread per call. 100,000 trivial futures: about 40 s with one OS thread each, 0.13 s on the pool.
  • Channels and select. recv() returns T?; a closed channel gives null.
  • Structured cancellation: dropping a future cancels its work at the next await or check point. Behavior change: a future that is dropped without being awaited is now cancelled instead of running in the background; a bare f(); call to a Future function warns.
  • Non-blocking I/O integrated with the pool (kqueue, epoll, IOCP). kqueue on macOS, epoll on Linux (tested on arm64); Windows uses WSAPoll, compiled but never run.
  • Async functions that run on the calling thread (async T f()), so waiting code shares plain values with no shared or lock, plus all, race and timeout. Future<T> functions stay the way to run CPU work in parallel.
  • A data-race rule: only values the compiler has marked thread-shared (M2) cross threads; ref struct needs an explicit shared or a lock. A plain ref struct can't cross threads; a shared ref struct's counted fields are read and written only under lock, scalars may be atomic. What isn't checked is listed in docs/book/reference.md.

Simpler concurrency (decided 2026-12-01, after reviewing JS/Swift async, Elixir and GCD): waiting is async, state owned by one thread of control is an actor, parallel work is explicit.

  • async T f(): runs on the calling thread like a JS promise (synchronously until its first wait, then resumes as a fiber on the same thread). Any value may be passed, including plain ref structs; no crossing checks, no locks. Future<T> functions stay the way to run CPU work in parallel. Built as specified; an async Future is bound to its thread (compile error where visible, panic otherwise). Without fibers (tcc, -DMXY_NO_FIBERS) the body runs to completion inside the call. Host run loops can drive it through mxy_async_run/mxy_async_fd.
  • await f()? means (await f())?. await all(fs), await race(fs), f.timeout(ms).
  • actor types (Elixir's GenServer, GCD's serial queue): each actor handles one message at a time, in order, on the pool. A void method called from outside returns at once (cast); any other returns a Future (call). Fields need no lock and no shared. Arguments follow the crossing rules; actors themselves cross freely. Not reentrant: a message that awaits keeps its actor busy, and actors awaiting each other in a cycle panic with every await's place (cycles through tasks or channels aren't detected). Messages are never cancelled. An idle actor costs its object (74 bytes with one long field, arm64 macOS); a cast costs about 150 to 250 ns end to end from one sender, a call's round trip about 5 µs from main and 2.8 µs between actors (machine loaded, load average 15 to 30): the round trips are thread wakeups, and a spin-before-park could cut them later.
  • Crash isolation: a panic inside an actor message fails that call (its await gets an error) instead of ending the program, and the actor keeps serving. Supervisors and restart policies come later, in std. await re-raises the panic with both places; f.result() gives it as an Err; a failed cast is printed. Caught with setjmp/longjmp: what the unwound frames held leaks (the debug leak report says so), gates opened inside are closed, and a panic while holding a lock stays fatal. Panics in pool tasks and async calls an actor started, and memory faults, stay fatal.
  • GCD-style parallel helpers: parallel for i in 0..n { }, xs.par_map(f), and spawn { ... } returning a Future. The body writes outside only as out[i] = ... by its loop variable; panics stop the loop and are raised in the caller, and spawn blocks fail their Future like actor calls. A 1600x1000 Mandelbrot: 1061 ms sequential, about 185 ms with parallel for or par_map on 10 cores under load. Loops under about 50 µs stay on the calling thread.

Phase 6: tooling

  • Language server: go-to-definition, references, rename, formatting, inlay types, code actions for the compiler's fix-its.
  • Extensions for VS Code and Neovim, alongside Zed.
  • [~] Debugger pretty-printers for strings, lists, maps and enums (lldb and gdb), on top of the existing #line mapping. LLDB works and is tested; GDB is written but untested (no gdb here).
  • moxy doc: generated API docs from comments.
  • test "name" { ... } blocks in any file, run by moxy test and left out of builds (ExUnit, Zig). Each block runs in its own process of one binary per file (--moxy-test N), so a failed assert, panic, crash or leak ends only that block; only the tested file's blocks run, not those of files it includes. In a project moxy test also covers src/, --filter picks tests by name, and the test cache covers them. Windows uses the same spawn path but hasn't run it.
  • Doctests: examples in doc comments are shown by moxy doc and run by moxy test. ```moxy fences run (with optional // prints: output), ```moxy norun ones only compile. std had no /// examples; the usage examples in the headers of path, fmt, date, datetime, deque, heap, orderedmap and json are now doc examples (the I/O, network and thread ones are not), and every claim they check held.
  • Incremental builds: cache generated C per file and rebuild only what changed. Per project, not per file, since a program is one C translation unit: emit is skipped when inputs are unchanged, and cc when the C is identical.
  • [~] Fast debug builds. A hello-world moxy run takes 212 ms, of which 4 ms is Moxy compiling to C and about 90 ms is cc re-parsing the embedded runtime; about 120 ms is unexplained. Find and remove the unexplained part, precompile the runtime once per compiler version instead of per build, and evaluate tcc for debug moxy run. Target: hello-world moxy run under 60 ms. Hello-world moxy run: 20 ms with tcc on PATH (optional, auto-detected), 150 ms with cc only (was ~200). About 85 ms of the cc path is macOS checking a newly linked binary on first launch, which moxy can't avoid. The runtime is a cached precompiled header.

Phase 7: ecosystem and project

  • [~] A browser playground: the compiler built to WebAssembly, the generated C shown beside the output. Compiles to C in the browser (386 KB wasm); running programs in the browser is not done.
  • A docs site with the tutorial, reference and memory chapter. The Pages workflow has not run yet; Pages must be set to "GitHub Actions" in repo settings.
  • [~] A package index on top of the existing git dependencies, with moxy search and moxy publish. moxy search, moxy add <name> and moxy publish work against any git index (tested with a local one); the hosted index repository (github.com/moxylang/index) doesn't exist yet.
  • [~] Move the repository to an organization, add a contribution guide, and label starter issues. CONTRIBUTING.md and docs/starter.md exist; the move and the issue labels need the maintainer.
  • A language change process: short written proposals for anything that changes syntax or semantics.
  • 1.0 criteria written down: a compatibility promise for syntax, the C output ABI and moxy.yaml.

Phase 8: production quality (after the freeze)

Nothing new to learn; everything gets more solid, faster and lighter.

  • Fuzz the lexer, parser, type checker and code generator (crashes, hangs, invalid C) and run it in CI; every crash becomes a test. tools/fuzz: libFuzzer on the pipeline in process under ASan and UBSan, structural mutations of the test programs with an invalid C oracle, and a reducer; make fuzz runs both briefly and the CI fuzz job runs it. Fixes and their tests are in tests/fuzz/. Invalid C at a line of the program is listed, not failed, since unknown names are C (see docs/book/architecture.md#fuzzing).
  • [~] Differential testing: generated C compiled with clang, gcc and zig cc, at -O0 and -O2, under ASan, UBSan and TSan, must agree. Linux x86_64 and arm64, macOS, Windows in CI. scripts/matrix.sh runs every cell and CI has the jobs; every cell passes locally on Linux arm64 and macOS arm64, and the plain and UBSan cells on x86_64 under qemu-user. Open until the CI jobs have run green, x86_64 has been run on real hardware, and Windows (cross-built only so far) has run its cell.
  • [~] Soak tests: long-running server, actor and channel workloads for hours, with flat memory, file descriptors and threads. bun bench/soak.ts runs the workloads and fails on growth; 35-minute runs on macOS and Linux are flat for actors and channels, and fiber stacks are now given back after a burst. Open: the http server's resident memory crept 6.6 MB/h on macOS in one run while live allocations stayed flat (likely the allocator keeping freed pages, not proven), Linux has no complete actors run, and nothing has run for hours.
  • [~] Resource budgets checked in CI: compiler memory, self-compile time, binary size, runtime header size, idle memory and threads of a hello-world and an async server, cache size on disk. make budget against bench/budget.json, run by CI on Linux and macOS. Open until the Linux limits (measured on arm64) are confirmed on CI's x86_64.
  • [~] Benchmarks published with every release from a quiet machine, with a regression gate. 0.4.0's page was taken at load 4.6 to 6.6, not quiet; the gate is bench/baseline.json in CI. Open until a release's page comes from an idle machine as part of the release steps.
  • moxy test stops a test that runs past a time limit and kills its whole process group. Today a hung test hangs the run, and killing the runner from outside leaves the test process running (found 2026-12-02: three orphaned sanitizer test binaries spinning for hours).
  • Every compiler error has a test, a stable code and a docs entry; no internal errors reach users. Codes, docs and tests are done: 317 codes, each with a docs/errors.md entry (moxy explain) and a test, checked by make test; a crash in the compiler is an internal compiler error with a location instead of a signal. Open until fuzzing stops finding crashes.
  • [~] Panics, leaks and races in the standard library: run std's tests under every sanitizer on every platform. The matrix runs std's tests in every cell; Linux arm64 and macOS are clean under ASan with LeakSanitizer, UBSan and TSan. Open for the same platforms as differential testing.
  • Performance passes on what real programs do: startup, string and collection heavy code, I/O, the pool.
  • A 1.0 release checklist, run on a release candidate.

Phase 9: all Moxy (0.5)

Decided 2026-12-02: the repository is written in Moxy wherever a host doesn't force another language. Moxy still compiles to C, and C compatibility and the C comparisons stay; what changes is that Moxy's own code is Moxy. 0.4.0 ships first from the frozen feature set; this phase is 0.5.0.

  • MoxyScript: .mxys files run as scripts, as Elixir runs .exs next to .ex. Top-level statements run in order with no main; a #!/usr/bin/env moxy line is allowed; moxy file.mxys args or the file itself runs it; compiled transparently and cached by content (bounded cache), with tcc when present for instant starts. A script can include .mxy files and std. Test files may be .mxys.
  • The runtime (runtime/*.h, about 6,200 lines of C) rewritten as .mxy, compiled to the same C headers when the compiler is built, with no loss in speed, memory or self-compile time. The fiber switch's inline assembly stays inline assembly inside Moxy.
  • Tooling in Moxy: the site generator, bench runner, budget check, fuzz oracle, test scripts and scripts/*.sh become .mxys or Moxy programs; the language server becomes a Moxy program.
  • What stays in another language, because the host requires it: the VS Code extension (JavaScript), the Neovim plugin (Lua), the browser glue that loads the WebAssembly playground, and the generated C bootstrap seed.

Edit this page on GitHub