Not that difficult. See e.g. https://github.com/rochus-keller/Oberon#lua-source-and-bytec..., https://github.com/rochus-keller/Smalltalk#a-smalltalk-80-in..., or here a whole list of other language frontends: https://github.com/hengestone/lua-languages
back
> I'd be surprised if anyone other than Mike Pall was able to retarget it to support a different language.
1 comments
Sorry, that's not quite what I had in mind. I was considering the feasibility of modifying LuaJIT to directly target a different language.
The projects you link to all either compile to, or are written in, Lua source code or LuaJIT bytecode. That's less efficient than retargeting the LuaJIT VM. For example, LuaJIT includes bytecode instructions specifically tailored to Lua tables. It looks like these projects build, say, their array data structures on top of those existing instructions, rather than adding array-specific support to LuaJIT.
> That's less efficient than retargeting the LuaJIT VM
That's like saying LLVM is inefficient because all the frontends compile to LLVM IR.
E.g. the Oberon compiler directly generates efficient LuaJIT bytecode also using FFI and even reuses the VM features for it's source-level debugger. Then benchmark written in Oberon has nearly the same performance like compiled to native when it runs on LuaJIT
Maybe this https://github.com/mingodad/ljs and this https://github.com/mingodad/ljsjit does to some degree what you have in mind ?