Description of 5.3 bytecode operations?

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

Description of 5.3 bytecode operations?

Charles Heywood
I'm working on a project that involves dealing with Lua bytecode; is there a documentation that describes how bytecode works in human readable format?
--

Reply | Threaded
Open this post in threaded view
|

Re: Description of 5.3 bytecode operations?

Satoru Kawahara

There is no documantation for Lua 5.3 bytecode.
"A No Frill Introdution to Lua 5.1 Instruction"[1] is a famous research for Lua 5.1 bytecode.
I've tried to read the 5.3 bytecode with the paper and implemented the decode/encoder[2] written in MoonScript.
I hope I can be of any help to you.



On Sun, Sep 11, 2016 at 10:49 AM Charles Heywood <[hidden email]> wrote:
I'm working on a project that involves dealing with Lua bytecode; is there a documentation that describes how bytecode works in human readable format?
--

Reply | Threaded
Open this post in threaded view
|

Re: Description of 5.3 bytecode operations?

Dirk Laurie-2
In reply to this post by Charles Heywood
2016-09-11 3:49 GMT+02:00 Charles Heywood <[hidden email]>:

> I'm working on a project that involves dealing with Lua bytecode; is there a
> documentation that describes how bytecode works in human readable format?

You have, of course, studied the comments in lopcodes.h?

Reply | Threaded
Open this post in threaded view
|

Re: Description of 5.3 bytecode operations?

Luiz Henrique de Figueiredo
In reply to this post by Charles Heywood
> I'm working on a project that involves dealing with Lua bytecode; is there
> a documentation that describes how bytecode works in human readable format?

The physical layout of precompiled scripts is described in ldump.c.
If you need to read precompiled scripts, see lundump.c.
Be aware that precompiled scripts are binary files that are not portable
across different platforms.

See also the print section of luac.c.

The logical structure of the Lua VM is described in lopcodes.h.
The semantics is implemented in lvm.c.

Reply | Threaded
Open this post in threaded view
|

Re: Description of 5.3 bytecode operations?

Miroslav Janíček
In reply to this post by Charles Heywood
Hi,

> On 11 Sep 2016, at 3:49, Charles Heywood <[hidden email]> wrote:
>
> I'm working on a project that involves dealing with Lua bytecode; is there a documentation that describes how bytecode works in human readable format?

Apart from the classic "A No-Frills Introduction to Lua 5.1 VM Instructions” by Kein-Hong Man, you might find Dibyendu Majumdar’s notes on Lua 5.3 bytecode useful:

  http://the-ravi-programming-language.readthedocs.io/en/latest/lua_bytecode_reference.html

  M.