Compiling to lua bytecode

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Compiling to lua bytecode

Marcus Mason
Hello all, recently I've been thinking of using lua as a target for a little language I've been working on, however I'm aware that lua's bytecode is not documented and it is not covered considered good practice to execute precompiled bytecode. That being said are there any unofficial resources on the format for a recent version of lua? (>= 5.3)
Reply | Threaded
Open this post in threaded view
|

Re: Compiling to lua bytecode

Luiz Henrique de Figueiredo
> are there any unofficial resources on the [bytecode] format for a recent version of lua? (>= 5.3)

The official resource is https://www.lua.org/source/5.3/lopcodes.h.html.

I suggest you compile your language to Lua, not to Lua bytecode.

Reply | Threaded
Open this post in threaded view
|

Re: Compiling to lua bytecode

Marcus Mason
I might look at doing that perhaps it will end up being easier in the end. Out of curiosity, why was the decision RE the bytecode not being a recommended target made?

On Tue, 12 Nov 2019, 10:50 Luiz Henrique de Figueiredo, <[hidden email]> wrote:
> are there any unofficial resources on the [bytecode] format for a recent version of lua? (>= 5.3)

The official resource is https://www.lua.org/source/5.3/lopcodes.h.html.

I suggest you compile your language to Lua, not to Lua bytecode.

Reply | Threaded
Open this post in threaded view
|

Re: Compiling to lua bytecode

Luiz Henrique de Figueiredo
> why was the decision RE the bytecode not being a recommended target made?

Because the Lua VM is an implementation "detail", tailored to each
specific version of Lua. The VM is likely to change for each Lua
version.