Skip to content

2. Quick Start

AsynchronousAI edited this page Sep 1, 2025 · 3 revisions

Starting with C code.

Let us start by writing a simple "Hello, World!" in C!

Step 1. Writing your C Code.

int printf(const char *, ...);

int main(){
   printf("Hello, World!");
   return 0;
}

Note

Only certain functions are built into the runtime (printf & malloc). Other functions (or custom ones 👀) will need a manual implementation and bindings.

Step 2. Compiling to ASM

We can then compile into an assembly file:

clang -S -march=rv32imfd -target riscv32-unknown-elf main.c -o main.s

Certain parameters like -O3 can also be used to perform assembly level optimizations.

Important

The compiled code MUST be RV32IM which means RISC-V, 32bit, Integer, Multiplication, Floating, Double. In the future floating point & vectors could make an addition.

Step 3. Making Luau Code

reasm main.s -o main.luau

These options also exists:

  • --comments: This will annotate the generated code with the original ASM instructions.
  • --trace: A much more extreme option which will log every update to the Program Counter.

Step 4. Running the Luau Code

You should now have a main.luau file which when ran successfully prints "Hello, World!"! Screenshot 2025-08-31 at 8 59 01 PM

Clone this wiki locally