Lua 5 assembler – Chunkbake (.LUA bytecode bestanden)
ChunkBake is a line-oriented assembler for Lua 5 virtual machine instructions. It produces a binary chunk from assembly code, which can then be loaded and run on a Lua 5 virtual machine. ChunkBake is an educational tool; you’d probably won’t be writing substantial Lua applications in assembly language form (but if you are, please pass me some of the stuff you’re smoking… ) The syntax of ChunkBake bears a resemblance to luas assembly code, with differences. The front end was written to accomodate a variety of coding styles, e.g. registers can be written as 0, R0 or $0.
ChunkBake is written in Lua so that it is portable and easy to hack. Binary chunks that are generated can be customized with different data and field sizes and number types, so if you want to produce non-standard chunks from assembly code, this is the tool for you. You can break a lot of rules as well, and do things the Lua 5 code generator won’t do. If you want a smaller assembler, a lot of code can be ripped out.
ChunkBake currently works only for Lua 5.0.2 instructions.
Processing speed is brisk so there shouldn’t be speed issues. For pre-1.0 releases, the syntax is open for fixes or changes. If there are better ways to write some of the assembly syntax, or if there is a defacto standard for such things, the assembler syntax MAY CHANGE for pre-1.0 releases.
[0.7.0] Major update:
General Lua-style expressions for most values and operands.
Equate (.equ) directive, using the global symbol table.
Unified symbol namespace, added a global symbol table.
Number conversion supports positive and negative infinity.
Fixed instruction encoding bug for setupval and getupval.
Range operator changed from ‘..’ to ‘…’ to accommodate expressions.
Added additional warning and error messages for certain instruction patterns.
Constant declaration and operands can use nil; added a few more examples;
basic reference documentation completed.
This is a preliminary release. Rudimentary but complete. Many bugs have been ironed out by the test script. Quite usable.