mjanicek / rembulan

Rembulan, an implementation of Lua 5.3 for the Java Virtual Machine
Apache License 2.0
163 stars 28 forks source link

Add support for binary chunks #12

Open mjanicek opened 8 years ago

mjanicek commented 8 years ago

Rembulan is currently only able to load text chunks. It might be a good idea to consider adding support for binary chunks.

Java bytecode (as generated by Rembulan), even packed in a JAR file, is probably too low-level for this purpose. Classes in Java bytecode are named, whereas function prototypes in the binary chunk should be (mostly) anonymous. Additionally, there is no way of controlling the origin of the JAR file (and hence its contents): most users would not want to load arbitrary bytecode if they expect a pre-compiled Lua function.

Therefore, these binary chunks should probably be based on the compiler's already-existing IR (intermediate representation).

Advantages

The following steps are required in order to implement this feature such that it is usable/useful: