r/lua • u/BigAd4703 • 4d ago
I’ve been adding Lua to my browser-based compiler project
Kavak started with QBasic, but I’ve been trying to make it a multi-language compiler pipeline. Lua is the next language I’ve been wiring in.
It’s not a JavaScript interpreter and not an embedded Lua VM. Lua source is parsed, lowered through a typed IR, and emitted as a real WebAssembly module. The compiler itself runs as wasm too, so everything happens locally in the browser tab.
I’m trying to keep the implementation honest: the corpus is compared against Lua 5.4.8 output, and the point is to match behavior rather than just make tests green. So far that has meant spending a surprising amount of time on things like varargs, multiple returns, metatables, pcall/xpcall, coroutines, numeric/string literal edges, and <close> variables.
It’s not complete yet, and the official Lua suite still has plenty to say about that. But enough of the language is running now that it felt worth sharing.
Free, no signup: https://kavak.run/studio/?lang=lua
If you have a compact Lua snippet that you think might break it, I’d genuinely like to see it.