Skip to content

Latest commit

 

History

History
36 lines (34 loc) · 1.21 KB

README.md

File metadata and controls

36 lines (34 loc) · 1.21 KB

roblox-llvm

This is a project to compile LLVM IR to Roblox Luau.

Example:

Usage:

$ rbxllc <input.ll> -o <output.lua>

Flags:

  • -o <output.lua>: Output file
  • -v or --version: Print version information
  • -s: generate code that is buffer-overflow strict. This will make the generated code slower, larger, and less readable but can fix programs that depend on buffer overflow behavior.
  • -nb: do not use the bit32 library. Reccomended for non-luau ecosystems.
  • -cbuf: generated code will declare functions from the Luau buffer library to be resolved. Reccomended for non-luau ecosystems.
  • -cbit: generated code will declare functions from the Luau bit32 library to be resolved. Reccomended for non-luau ecosystems.

Installation:

Requirements:

  • LLVM 14 (not higher)
  • pip install llvmlite
  • python3 You can install prebuilt binaries from the releases page.

Using the example:

  1. Compile test.c to test.ll using clang:
$ clang -S -emit-llvm test/test.c -o test/test.ll
  1. Compile test.ll to test.lua using rbxllc:
$ rbxllc test/test.ll -o test/test.lua
  1. Run test.lua using luau:
$ luau test.lua
Hello, World!