Lua's bytecode specification [closed]

拜拜、爱过 提交于 2019-11-29 02:10:45

问题


Can anyone tell me where to find Lua's bytecode specification? I've been searching for 15 minutes, and I can't find anything.


回答1:


Maybe A No-Frills Introduction to Lua 5.1 VM Instructions contains what you're looking for?

There is also a table of the Lua 5.0 instruction set (Figure 5) in:

Ierusalimschy, R.; Figueiredo, L. H.; Celes, W. (2005), "The implementation of Lua 5.0", J. of Universal Comp. Sci. 11 (7): 1159-1176

You can find the full text with a search on Google Scholar and I believe it's on lua.org as well. This reference is used by the Lua page on Wikipedia, which is always a good place to look for such things. :-)




回答2:


The official definition is in lopcodes.h.




回答3:


The only specifications for Lua are the language, standard libraries, and the C API. The creators of Lua intentionally left the VM unspecified for a couple main reasons:

  • Lua can be fully implemented with any underlying architecture (VM, interpreter, compiler, etc.)
  • The official Lua distribution doesn't have to worry about maintaining VM compatibility between versions

This means, for example, that you generally shouldn't use the Lua VM as a target for a compiler. If you'd like to know how the official Lua distribution's VM works as an example for your own curiosity, see the other answers.




回答4:


You can read The Implementation of Lua 5.0 online.



来源:https://stackoverflow.com/questions/1480678/luas-bytecode-specification

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!