A JS/TS machine-language platform written in Rust — architected after the
.NET runtime (CLR): a real compile step that produces a binary IL + metadata
format (.zm), and a VM that loads, verifies, and executes it natively via
Cranelift (interpreter Tier 0 → JIT Tier 1).
This is not a V8-style runtime. Typed TypeScript gets fixed object layouts
and vtable dispatch; dynamic JavaScript (any) is the explicit, costly
exception — a boxed Any value with IL-level box/unbox and a
DynamicObject. You pay for dynamism only where you actually use it.
Evolved from the RTS prototype. Zun is the successor to urubucode/rts, a TypeScript→native compiler built on Cranelift. RTS proved the approach; Zun rebuilds it on a real IL + metadata contract and a verifiable VM, aiming for a more compatible and more correctly applied model of the language. One thing Zun keeps verbatim is RTS's discipline of measuring itself against real runtimes — see Cross-runtime conformance below.
The compiler and the VM never share in-memory ASTs. They communicate only through the ZIL binary format, which references types and members by metadata token, never by offset. That boundary is what makes the rest possible:
- Verification before execution. A module is checked for type- and memory-safety at load time, the way the CLR verifies IL.
- Tiered execution. An always-correct interpreter (Tier 0) runs immediately; hot code is JIT-compiled by Cranelift (Tier 1) behind redirectable entry points, so tiering and on-stack replacement never require a redesign.
- A single source of truth for opcodes. One master table generates the assembler, disassembler, verifier, and codegen importer — opcode knowledge is never hand-copied into a second place.
See PLAN.md for the full architecture, the crate map, and the
implementation phases. Design decisions are grounded in
.docs-dotnet/, a 10-area analysis of dotnet/runtime.
Zun measures its own JavaScript/TypeScript compatibility the way the RTS
prototype did: every fixture under tests/ is a standalone program run
on Bun, Node, and Zun, with stdout compared byte-for-byte. The
conformance rate is pass / reachable, where reachable excludes fixtures that
have no canonical answer (Bun and Node themselves disagree) or a proven upstream
defect — so the rate's ceiling is a real 100%.
The table below is regenerated by CI on every push to main. See
tests/README.md for the status model, how to write a
fixture, and how to run the harness locally.
Pending the first CI run — the conformance table is generated by
scripts/tests_check.sh and committed by the tests workflow.
Progress per category is tracked in a single living GitHub issue per category
(label conformance), each with a checklist of its fixtures and a progress bar —
not hundreds of one-off issues. These numbers are Zun's own measurements, not an
official conformance certification.
# Build the embedded engine and the `zun` binary (target/release/zun):
cargo run -p xtask -- package
# Compile and run a TypeScript program:
target/release/zun run path/to/program.ts
# Run the full workspace test suite:
cargo testNote.
cargo run -p xtask -- packagebuildszun_runtimein release, compresses it, and rebuildszun_cliwith the embedded payload, then runs the self-provision check end to end.
PLAN.md # architecture plan (reference)
GOAL.md # project goals
.docs-dotnet/ # .NET runtime analysis, 10 areas (reference)
docs/guides/ # engineering references (e.g. Cranelift 0.131)
crates/ # Cargo workspace — compiler, format, and VM crates
std/ # standard library, typed TS compiled by Zun itself
tests/ # cross-runtime conformance fixtures, by category
scripts/ # tooling, incl. the cross-runtime harness
xtask/ # build/packaging tasks
The format crates (zun_il, zun_metadata, zun_module) are the contract.
Compile-time crates and runtime crates both depend on the format but never on
each other — only the driver/CLI links both.
Zun is in active development and is not yet production-ready. The language model, the IL, and the VM are evolving together; expect sharp edges. The cross-runtime conformance numbers above are the honest, continuously-measured picture of where the engine actually stands.
See LICENSE if present; otherwise the repository's license applies
as stated by the owner.