Skip to main content

MEP-53 research notes

These twelve notes are the deep research that fed MEP-53 (Mochi-to-Rust transpiler). They are informative; the MEP body at /docs/mep/mep-0053 is normative. Each note is self-contained and can be read independently. Cross-references use [[note-slug]] markers.

Author: research pass for MEP-53 (Mochi-to-Rust transpiler). Date: 2026-05-29 (GMT+7).

#TitleTopic
01Language surfaceMochi features mapped onto Rust 1.78+ lowering obligations
02Design philosophyWhy Rust, why 1.78 floor, why single-thread runtime, why Box, why no tokio
03Prior-art transpilersbindgen / cbindgen, rust-bindgen, rapydscript-ng, rune, cretonne / Cranelift, gccrs, Polonius, mrustc, Rust-GPU, IL2Rust analogues, Embedded Rust, SwiftWasm comparison
04Runtime building blocksRust stdlib, alloc crate, std::collections, std::net, panic::catch_unwind, no_std + alloc convention, the rejected tokio / reqwest / serde / sha2 alternatives
05Codegen designRust source via rtree IR (not syn / quote), aotir reuse, the colour pass for borrow-and-clone elision, 4-space indent, stable item ordering
06Type-system loweringMochi types onto i64 / f64 / String / Vec / HashMap / HashSet / struct / tagged enum / Box, the Rc single-thread choice
07Rust target and portabilityRust 1.78 / 1.95 matrix, host triples, cargo-zigbuild musl, wasm32-wasip1 (renamed from wasm32-wasi), no_std + alloc embedded, why no Polonius / gccrs / mrustc
08Dataset pipelineQuery DSL via Iterator + itertools, BTreeMap for deterministic group-by, compile-time Datalog (semi-naive fixpoint) emitted as frozen Vec literals
09Agents and streamsAgents as plain structs (no threads), single-thread Rc<RefCell> channels, single-thread broadcast streams, why Arc rejected, async colouring with no runtime effect
10Build systemCargo as canonical driver, deterministic Cargo.toml, SOURCE_DATE_EPOCH=0 + RUSTFLAGS=-C strip=symbols, cargo zigbuild for musl, wasmtime for wasm, the cffi/ sidecar + cc-rs build script
11Testing gatesPer-phase Go test gates with vm3 oracle, byte-equal stdout diff, cargo check secondary gate, reproducibility SHA-256 gate, publish dry-run, embedded cargo check
12Risks and alternativesRisk register (LC_UUID macOS, generic-closure storage, wasm32 no-TCP, cc-rs detection, cassette drift, embedded surface gap) + rejected alternatives (tokio, reqwest, serde, sha2, Arc/Mutex, impl Fn, syn / quote, inlined runtime, no published crate)

Each note's filename uses the NN-slug.md convention; the leading NN- is stripped by Docusaurus for the URL path, so cross-links inside the notes use the unprefixed slug (e.g. [[language-surface]]).

The companion MEP body lives at /docs/mep/mep-0053. Implementation tracking lives at /docs/implementation/0053/.