Skip to main content

MEP-50 research bundle: Mochi to Kotlin transpiler

Author: research pass for MEP-50 (Mochi to Kotlin transpiler). Date: 2026-05-23 (GMT+7).

This bundle contains the twelve research notes that informed MEP-50, the Mochi-to-Kotlin transpiler. The notes are informative; the normative spec is in the MEP body.

#TitleTopic
01Language surfaceThe Mochi language surface and its Kotlin 2.1 lowering obligations
02Design philosophyWhy Kotlin, why the 2.1 floor with K2, why Channel + CoroutineScope over the deprecated actor { } builder, why all KMP targets
03Prior artSurvey of source-to-Kotlin transpilers: J2K (IntelliJ Java-to-Kotlin), ts2kt, KotlinPoet, the Compose UI compiler, J2CL
04RuntimeThe MochiRuntime KMP Gradle module: kotlinx.coroutines, kotlinx.serialization, kotlinx.collections.immutable, kotlinx.datetime, Datalog, agent supervisor, JSONValue
05Codegen designIR-to-Kotlin lowering via KotlinPoet, ktfmt integration, aotir IR reuse
06Type loweringPer-type details for every Mochi type (Long, Double, String, List, LinkedHashMap, data class, sealed interface, custom actor class, Flow)
07Target portabilityKMP target matrix: JVM 17+, Android minSdk 24 / targetSdk 35, Kotlin/Native (iOS, macOS, Linux, Windows), Kotlin/JS (browser, Node.js), Kotlin/Wasm (Wasm GC)
08Dataset pipelineQuery DSL lowering via Kotlin Sequence + Flow + kotlinx.collections.immutable; Datalog engine
09Agents and streamsMochi agents as a custom actor class wrapping Channel<Message> + CoroutineScope(SupervisorJob() + Dispatchers.Default); Flow<T> streams; structured concurrency
10Build systemGradle Kotlin DSL, Kotlin Gradle Plugin, Android Gradle Plugin 8.7+, Maven Central publish, gradle/libs.versions.toml catalog, Gradle wrapper 8.11+
11Testing gatesPer-phase Go test gates, Kotlin 2.1.0 / 2.1.20 version matrix, Play Console pre-launch validation, Kotlin/Native single-binary gate
12Risks and alternativesRisk register, Java-source emission rejected, Scala interop rejected, Groovy DSL rejected, v2 deferrals (Compose Multiplatform, embedded Kotlin, distributed agents)

Cross-references