A native compiler + runtime platform that executes existing React applications with zero JavaScript at runtime.
R2N compiles React/JSX source into a language-neutral artifact (RuntimeTemplate IR), then executes it on a zero-JS runtime: no JS engine, no Node.js, no JavaScript anywhere in the shipped runtime. Renderers consume a single Patch stream — the ABI boundary — so memory, native, WASM, and terminal backends all receive identical reconciliation output.
source (.r2n) → Lexer → Parser (AST) → Lowering → JS IR ─┐
React IR ─┤
RuntimeTemplate IR ─┘
│
zero-JS runtime ←──┘
event → handler → state
→ dirty → render → diff
│
Patch stream (ABI)
│
Memory · Native · WASM · Terminal
| Milestone | State | Progress |
|---|---|---|
| M0.1 Foundation — workspace & vertical slice | DONE | 13/13 |
| M0.2 Reactive runtime loop | DONE | 14/14 |
| M0.3 Compiler frontend (JS/JSX → IR) | DONE | 9/9 |
| M1 React compatibility — hooks, keys, context, effects | DONE | 18/18 |
| M2 JavaScript compatibility — full ECMAScript semantics | in progress | 4/15 |
| M3–M7 | planned | — |
Overall: 62/106 roadmap tasks. Every claim above is backed by the test suite (cargo test) and the architecture-guard tests. See roadmap/CHECKLIST.md for the task-level record, JOURNAL.md for decision history, and docs/AUDIT.md for the latest audit report.
- Compiler pipeline: real hand-written lexer (JSX-text aware, byte-offset tracking) → recursive-descent parser (precedence climbing, arrows, block bodies, JSX children incl. raw text) → three-layer interlinked IR (JS IR → React IR → Runtime IR), serde-serializable to JSON.
- Zero-JS runtime: closed-set ABI values (null/bool/f64/UTF-16 string/array/map/setter/handler),
useState/useEffectvia the per-instance frame protocol, keyed(type, key, path)reconciliation producing minimalPatch[], event dispatch running handler closures against their owning frame + saved scope. - Event-driven reactive loop:
onClick={() => setN(n + 1)}→dispatch→ setter → dirty → flush → exactly oneSetTextpatch, no parent recreation. Two component instances hold independent state. - Memory renderer: applies the same patch stream any backend would; XML-style tree serialization for tests.
- CLI:
r2n build(JSON artifact) ·r2n render(initial tree) ·r2n run file 3(fires real click events).
Everything in M2–M7: the remainder of full ECMAScript semantics (objects/prototypes, closures, classes, coercion, exceptions, promises, generators, modules), the specialization/optimization pipeline, non-memory renderers (native/WASM/terminal), the Go/Elixir runtimes, npm/browser-API compatibility, and productionization. The issues board tracks all of it; nothing is claimed that isn't tested.
- The runtime never sees source code —
r2n-runtimehas zero dependencies on parser/AST/compiler;tests/architecture.rsfails the build if that changes. - Renderers consume only the
Patchstream — same ABI for every backend. - The artifact is language-neutral data — JSON-serializable
RuntimeTemplate; closures cross boundaries as (path, IR) pairs, never Rust function pointers. - No stubs — a milestone closes only when its acceptance tests pass, never because an API exists.
cargo build --workspace
cargo test --workspace # 186 tests incl. architecture + acceptance guards
cargo clippy --workspace --all-targets -- -D warnings
scripts/verify-audit-claims.sh # re-derives every README/roadmap claim from sourcecrates/r2n-ast source-level AST (Expr, Element, Stmt, Program)
crates/r2n-parser hand-written lexer + recursive-descent parser
crates/r2n-ir JS IR + React IR + Runtime IR + lowering + JSON artifact
crates/r2n-runtime zero-JS evaluator, hooks (frame protocol), reconciler, events
crates/r2n-renderer-memory reference renderer consuming the Patch stream
crates/r2n-compiler orchestration: parse → lower → artifact
crates/r2n-cli r2n build / render / run
roadmap/ ROADMAP.md, CHECKLIST.md, roadmap.yaml/toml (source of truth)
scripts/ CI verification scripts (auditable claims)
docs/ audit reports
examples/ counter / hello / list
MIT OR Apache-2.0 (dual-licensed, like the Rust ecosystem).