Lua really is the MLIR (mid-level intermediate representation) from the future.
Currently in the process of porting the parser & codegen that's implemented in Javascript to Lua so that I can have the implementation bootstrap itself. Plus the codegen was for a bytecode I came up with in JS but which has evolved quite a bit since getting everything in place to happen in WASM
It looks like you are in the process of porting the .js to .lua? Wasm will exist in many more places than Js will.
I think I would have started with many of the Lua on Js implementations and used zero Js.
Have you seen http://stefan-marr.de/2015/10/jit-data-structures-fully-refl...
Check out this paper, https://www.cs.purdue.edu/homes/rompf/papers/amin-draft2017a... Collapsing Towers of Interpreters
Thanks for the links