Skip to content

Repository files navigation

R2N — React to Native

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

Status — audited 2026-08-30

MilestoneStateProgress
M0.1 Foundation — workspace & vertical sliceDONE13/13
M0.2 Reactive runtime loopDONE14/14
M0.3 Compiler frontend (JS/JSX → IR)DONE9/9
M1 React compatibility — hooks, keys, context, effectsDONE18/18
M2 JavaScript compatibility — full ECMAScript semanticsin progress4/15
M3–M7planned

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.

What works today (all test-verified)

  • 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/useEffect via the per-instance frame protocol, keyed (type, key, path) reconciliation producing minimal Patch[], event dispatch running handler closures against their owning frame + saved scope.
  • Event-driven reactive loop: onClick={() => setN(n + 1)}dispatch → setter → dirty → flush → exactly oneSetText patch, 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).

What is deliberately not done yet

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.

Architecture rules (enforced by CI, not by convention)

  1. The runtime never sees source coder2n-runtime has zero dependencies on parser/AST/compiler; tests/architecture.rs fails the build if that changes.
  2. Renderers consume only the Patch stream — same ABI for every backend.
  3. The artifact is language-neutral data — JSON-serializable RuntimeTemplate; closures cross boundaries as (path, IR) pairs, never Rust function pointers.
  4. No stubs — a milestone closes only when its acceptance tests pass, never because an API exists.

Build & test

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 source

Layout

crates/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

License

MIT OR Apache-2.0 (dual-licensed, like the Rust ecosystem).

About

React to Native: a compiler + zero-JS runtime platform that executes React applications with zero JavaScript at runtime — every claim CI-audited

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
GitHub - ncdevshiv/R2N: React to Native: a compiler + zero-JS runtime platform that executes React applications with zero JavaScript at runtime — every claim CI-audited · GitHub
Skip to content

Repository files navigation

R2N — React to Native

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

Status — audited 2026-08-30

MilestoneStateProgress
M0.1 Foundation — workspace & vertical sliceDONE13/13
M0.2 Reactive runtime loopDONE14/14
M0.3 Compiler frontend (JS/JSX → IR)DONE9/9
M1 React compatibility — hooks, keys, context, effectsDONE18/18
M2 JavaScript compatibility — full ECMAScript semanticsin progress4/15
M3–M7planned

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.

What works today (all test-verified)

  • 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/useEffect via the per-instance frame protocol, keyed (type, key, path) reconciliation producing minimal Patch[], event dispatch running handler closures against their owning frame + saved scope.
  • Event-driven reactive loop: onClick={() => setN(n + 1)}dispatch → setter → dirty → flush → exactly oneSetText patch, 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).

What is deliberately not done yet

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.

Architecture rules (enforced by CI, not by convention)

  1. The runtime never sees source coder2n-runtime has zero dependencies on parser/AST/compiler; tests/architecture.rs fails the build if that changes.
  2. Renderers consume only the Patch stream — same ABI for every backend.
  3. The artifact is language-neutral data — JSON-serializable RuntimeTemplate; closures cross boundaries as (path, IR) pairs, never Rust function pointers.
  4. No stubs — a milestone closes only when its acceptance tests pass, never because an API exists.

Build & test

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 source

Layout

crates/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

License

MIT OR Apache-2.0 (dual-licensed, like the Rust ecosystem).

About

React to Native: a compiler + zero-JS runtime platform that executes React applications with zero JavaScript at runtime — every claim CI-audited

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - ncdevshiv/R2N: React to Native: a compiler + zero-JS runtime platform that executes React applications with zero JavaScript at runtime — every claim CI-audited · GitHub
Skip to content

Repository files navigation

R2N — React to Native

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

Status — audited 2026-08-30

MilestoneStateProgress
M0.1 Foundation — workspace & vertical sliceDONE13/13
M0.2 Reactive runtime loopDONE14/14
M0.3 Compiler frontend (JS/JSX → IR)DONE9/9
M1 React compatibility — hooks, keys, context, effectsDONE18/18
M2 JavaScript compatibility — full ECMAScript semanticsin progress4/15
M3–M7planned

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.

What works today (all test-verified)

  • 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/useEffect via the per-instance frame protocol, keyed (type, key, path) reconciliation producing minimal Patch[], event dispatch running handler closures against their owning frame + saved scope.
  • Event-driven reactive loop: onClick={() => setN(n + 1)}dispatch → setter → dirty → flush → exactly oneSetText patch, 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).

What is deliberately not done yet

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.

Architecture rules (enforced by CI, not by convention)

  1. The runtime never sees source coder2n-runtime has zero dependencies on parser/AST/compiler; tests/architecture.rs fails the build if that changes.
  2. Renderers consume only the Patch stream — same ABI for every backend.
  3. The artifact is language-neutral data — JSON-serializable RuntimeTemplate; closures cross boundaries as (path, IR) pairs, never Rust function pointers.
  4. No stubs — a milestone closes only when its acceptance tests pass, never because an API exists.

Build & test

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 source

Layout

crates/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

License

MIT OR Apache-2.0 (dual-licensed, like the Rust ecosystem).

About

React to Native: a compiler + zero-JS runtime platform that executes React applications with zero JavaScript at runtime — every claim CI-audited

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - ncdevshiv/R2N: React to Native: a compiler + zero-JS runtime platform that executes React applications with zero JavaScript at runtime — every claim CI-audited · GitHub
Skip to content

Repository files navigation

R2N — React to Native

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

Status — audited 2026-08-30

MilestoneStateProgress
M0.1 Foundation — workspace & vertical sliceDONE13/13
M0.2 Reactive runtime loopDONE14/14
M0.3 Compiler frontend (JS/JSX → IR)DONE9/9
M1 React compatibility — hooks, keys, context, effectsDONE18/18
M2 JavaScript compatibility — full ECMAScript semanticsin progress4/15
M3–M7planned

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.

What works today (all test-verified)

  • 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/useEffect via the per-instance frame protocol, keyed (type, key, path) reconciliation producing minimal Patch[], event dispatch running handler closures against their owning frame + saved scope.
  • Event-driven reactive loop: onClick={() => setN(n + 1)}dispatch → setter → dirty → flush → exactly oneSetText patch, 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).

What is deliberately not done yet

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.

Architecture rules (enforced by CI, not by convention)

  1. The runtime never sees source coder2n-runtime has zero dependencies on parser/AST/compiler; tests/architecture.rs fails the build if that changes.
  2. Renderers consume only the Patch stream — same ABI for every backend.
  3. The artifact is language-neutral data — JSON-serializable RuntimeTemplate; closures cross boundaries as (path, IR) pairs, never Rust function pointers.
  4. No stubs — a milestone closes only when its acceptance tests pass, never because an API exists.

Build & test

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 source

Layout

crates/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

License

MIT OR Apache-2.0 (dual-licensed, like the Rust ecosystem).

About

React to Native: a compiler + zero-JS runtime platform that executes React applications with zero JavaScript at runtime — every claim CI-audited

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' GitHub - ncdevshiv/R2N: React to Native: a compiler + zero-JS runtime platform that executes React applications with zero JavaScript at runtime — every claim CI-audited · GitHub
Skip to content

Repository files navigation

R2N — React to Native

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

Status — audited 2026-08-30

MilestoneStateProgress
M0.1 Foundation — workspace & vertical sliceDONE13/13
M0.2 Reactive runtime loopDONE14/14
M0.3 Compiler frontend (JS/JSX → IR)DONE9/9
M1 React compatibility — hooks, keys, context, effectsDONE18/18
M2 JavaScript compatibility — full ECMAScript semanticsin progress4/15
M3–M7planned

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.

What works today (all test-verified)

  • 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/useEffect via the per-instance frame protocol, keyed (type, key, path) reconciliation producing minimal Patch[], event dispatch running handler closures against their owning frame + saved scope.
  • Event-driven reactive loop: onClick={() => setN(n + 1)}dispatch → setter → dirty → flush → exactly oneSetText patch, 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).

What is deliberately not done yet

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.

Architecture rules (enforced by CI, not by convention)

  1. The runtime never sees source coder2n-runtime has zero dependencies on parser/AST/compiler; tests/architecture.rs fails the build if that changes.
  2. Renderers consume only the Patch stream — same ABI for every backend.
  3. The artifact is language-neutral data — JSON-serializable RuntimeTemplate; closures cross boundaries as (path, IR) pairs, never Rust function pointers.
  4. No stubs — a milestone closes only when its acceptance tests pass, never because an API exists.

Build & test

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 source

Layout

crates/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

License

MIT OR Apache-2.0 (dual-licensed, like the Rust ecosystem).

About

React to Native: a compiler + zero-JS runtime platform that executes React applications with zero JavaScript at runtime — every claim CI-audited

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' GitHub - ncdevshiv/R2N: React to Native: a compiler + zero-JS runtime platform that executes React applications with zero JavaScript at runtime — every claim CI-audited · GitHub
Skip to content

Repository files navigation

R2N — React to Native

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

Status — audited 2026-08-30

MilestoneStateProgress
M0.1 Foundation — workspace & vertical sliceDONE13/13
M0.2 Reactive runtime loopDONE14/14
M0.3 Compiler frontend (JS/JSX → IR)DONE9/9
M1 React compatibility — hooks, keys, context, effectsDONE18/18
M2 JavaScript compatibility — full ECMAScript semanticsin progress4/15
M3–M7planned

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.

What works today (all test-verified)

  • 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/useEffect via the per-instance frame protocol, keyed (type, key, path) reconciliation producing minimal Patch[], event dispatch running handler closures against their owning frame + saved scope.
  • Event-driven reactive loop: onClick={() => setN(n + 1)}dispatch → setter → dirty → flush → exactly oneSetText patch, 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).

What is deliberately not done yet

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.

Architecture rules (enforced by CI, not by convention)

  1. The runtime never sees source coder2n-runtime has zero dependencies on parser/AST/compiler; tests/architecture.rs fails the build if that changes.
  2. Renderers consume only the Patch stream — same ABI for every backend.
  3. The artifact is language-neutral data — JSON-serializable RuntimeTemplate; closures cross boundaries as (path, IR) pairs, never Rust function pointers.
  4. No stubs — a milestone closes only when its acceptance tests pass, never because an API exists.

Build & test

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 source

Layout

crates/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

License

MIT OR Apache-2.0 (dual-licensed, like the Rust ecosystem).

About

React to Native: a compiler + zero-JS runtime platform that executes React applications with zero JavaScript at runtime — every claim CI-audited

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); GitHub - ncdevshiv/R2N: React to Native: a compiler + zero-JS runtime platform that executes React applications with zero JavaScript at runtime — every claim CI-audited · GitHub
Skip to content

Repository files navigation

R2N — React to Native

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

Status — audited 2026-08-30

MilestoneStateProgress
M0.1 Foundation — workspace & vertical sliceDONE13/13
M0.2 Reactive runtime loopDONE14/14
M0.3 Compiler frontend (JS/JSX → IR)DONE9/9
M1 React compatibility — hooks, keys, context, effectsDONE18/18
M2 JavaScript compatibility — full ECMAScript semanticsin progress4/15
M3–M7planned

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.

What works today (all test-verified)

  • 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/useEffect via the per-instance frame protocol, keyed (type, key, path) reconciliation producing minimal Patch[], event dispatch running handler closures against their owning frame + saved scope.
  • Event-driven reactive loop: onClick={() => setN(n + 1)}dispatch → setter → dirty → flush → exactly oneSetText patch, 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).

What is deliberately not done yet

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.

Architecture rules (enforced by CI, not by convention)

  1. The runtime never sees source coder2n-runtime has zero dependencies on parser/AST/compiler; tests/architecture.rs fails the build if that changes.
  2. Renderers consume only the Patch stream — same ABI for every backend.
  3. The artifact is language-neutral data — JSON-serializable RuntimeTemplate; closures cross boundaries as (path, IR) pairs, never Rust function pointers.
  4. No stubs — a milestone closes only when its acceptance tests pass, never because an API exists.

Build & test

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 source

Layout

crates/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

License

MIT OR Apache-2.0 (dual-licensed, like the Rust ecosystem).

About

React to Native: a compiler + zero-JS runtime platform that executes React applications with zero JavaScript at runtime — every claim CI-audited

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages