/optic-lua-dev

Primary LanguageJavaBSD 2-Clause "Simplified" LicenseBSD-2-Clause

Codacy Badge

Optic-Lua

Extensible, Ahead-of-Time Lua to JVM Compiler.

Installation

Clone or download the files from this repository, then build a standalone jar:

./gradlew shadowJar

You can also build a much smaller jar which only contains classes for running compiled Lua code:

./gradlew runtimeJar

Launch the compiler to see available options:

java -jar build/libs/optic-lua.jar --help

If you've compiled some Lua code to a .class file, you can run it by adding optic-lua-rt.jar to the classpath:

java -cp .:build/libs/optic-lua-rt.jar my_compiled_class

The project is developed using OpenJDK 11, however the generated code and runtime classes are compatible with Java 8.

Features

  • Lua 5.3 support
  • Ahead-of-Time compilation from Lua to runnable .class files
  • Compilation of Lua code to Java source code
  • Interactive shell
  • Analyze runtime statistics, such as common parameter types

Note that the compiler does not yet fully implement all of Lua and its standard library. You can track the progress here: Lua 5.3 implementation.

Planned features

  • Zero-overhead FFI to Java code
  • Ability to mix Lua and Java code in the same file
  • Embedding API