手写 WASM-GC 编译器,Kotlin 直出字节码
推荐指数 42.0 NO. 018 · 2026.07.18
发布2026/07/17Score99Comments28
为什么值得看
MiniKotlin 是一个从零用 C 编写的 Kotlin 子集编译器,前端解析后直接手写生成 WebAssembly GC 字节码,不依赖 JVM、LLVM 或 Binaryen。对需要浏览器端原生运行且厌恶 JavaScript 工具链重量的团队,这是一条全新的编译路径。
编辑判断
目前把 Kotlin 跑在浏览器里的主流方案是 Kotlin/JS 或 Kotlin/WASM,但都绕不过 Gradle 和庞大的 Kotlin 标准库。MiniKotlin 的激进之处在于连 Binaryen 都砍掉,直接把编译器自身编译成 WASM,实现浏览器内闭环编译。
这让人联想到 Zig 的 self-hosted 编译器路径,但 MiniKotlin 的场景更窄:它瞄准的不是通用开发,而是需要极小体积、确定性 GC 行为的嵌入式 WASM 场景,比如区块链合约或沙盒插件系统。
如果你在调研替代 AssemblyScript 或 Rust 的 WASM 方案,可以重点关注它的 GC 性能数据;但注意它目前只是语言子集,标准库覆盖度是最大未知数。
社区反馈
意见分歧 28 条评论
核心争论:LLM生成痕迹过重 vs 技术原创性价值,以及浏览器端编译的实用场景存疑
That's cool. I often write tiny blurbs of kotlin just to test out a simple algorithm. I often do this on kotlin playground because doing so inside a scratch file or test is somehow more cumbersome and slow. This ran and compiled something in 98ms on my smartphone, cool stuff.
This is very cool! Slightly off-topic though, I miss technical people writing in their own voice about the awesome things they've built.
Chances are they aren't a technical person and didn't build it, so wouldn't have anything interesting to say anyways. Web compilers are dime-a-dozen and LLMs can easily produce them with no active guidance. Very much in the training data[1]. This looks like just another person posting something they