Open janvhs opened 6 months ago
Maintain compatibility with required C libraries like Löve, so the Lua ecosystem and package manager can still be used
Maybe add a static, structural type system based on set theory. Similar to Typescript and Elixir's plan. Moonscript and Neolua already do that and Lua has some type checking tools
Do optional static linking and compile to WASM if feasible
Embedding assets similar to Go's magic compiler comments or C's embedding macro would be fun, too
This should be possible without rewriting the whole Lua interpreter, as Lua already has two great implementations, which are supposed to be embedded. These are the official Lua and LuaJIT.
Although, I doubt it due to the nature of JIT compilers, the Bytecode of LuaJIT could be used as a starting point to generate native AOT code.
Shopify did something interesting with compiling JavaScript to WASM in the past, using the JIT bytecode of QuickJS. It's called Javi or something similar
Found the talk
Maybe compile Lua to C and use clang from there. Multiple languages are using this approach
For lua there is https://github.com/davidm/lua2c and luac2c
Embedd stylua, luacheck and the type checker from lua lsp as well as the lsp into a single toolchain
Existing Lua implementations in Go
Lua has no notion of a class hierarchy. Therefore, it might be a good fit for having a functional dialect. The dialect should have a relation similar to the relation between ReScript / Elm and JavaScript. It would be great to keep distinct parts of Lua's syntax and maintain its simplicity. That would be a fun project.
Furthermore, compiling Lua in an ahead of time manner would be very interesting. It has a dynamic type system, which makes it even cooler. Similar things have been done with the Trüffel set of languages and I've heard of an AOT ruby implementation, too. I just have to find the conference talk again