This project is an early-stage, from-scratch implementation of a Jai compiler, built entirely in Rust and powered by LLVM as the backend.
After more than a month of heavy AI-assisted development (and burning through over $20k worth of tokens), this is the first working prototype. It’s still rough, but most core Jai syntax is already supported. The compiler can parse, type-check, and generate LLVM IR for a growing subset of the language.
- Fully implemented in Rust
- LLVM backend for code generation
- Supports most core Jai syntax constructs
- Functional pipeline: parsing → AST → type checking → IR generation
- Designed to be hackable and easy to extend
This is an experimental prototype. Expect missing features, incomplete semantics, and occasional crashes. Feedback and contributions are welcome.
jai-compiler --help
Jai Compiler - an experimental Jai-compatible compiler
Usage:
jai-compiler <file.jai> compile a Jai source file
jai-compiler <file.jai> --run compile and run a Jai program with the bytecode interpreter
jai-compiler <file.jai> --run-native compile and run a Jai program as a native executable
jai-compiler <file.jai> --module-param <module.param=value> override a module parameter
jai-compiler <file.jai> --llvm compile with the LLVM backend
jai-compiler <file.jai> --llvm -o <out> compile with LLVM and emit an executable
jai-compiler <file.jai> --llvm --llvm-obj compile with LLVM and emit an object file
jai-compiler <file.jai> --llvm --llvm-opt <level> LLVM optimization level (none|less|default|aggressive)
jai-compiler <file.jai> --llvm --llvm-cpu <cpu> LLVM target CPU (default: generic)
jai-compiler <file.jai> --llvm --llvm-features <f> LLVM feature string
jai-compiler <file.jai> --llvm --llvm-target <triple> LLVM target triple (cross-platform)
jai-compiler <file.jai> --llvm --llvm-layout print LLVM ABI layout details
jai-compiler --tokens <file.jai> print lexer tokens
jai-compiler -debugger <file.jai> recognize the interactive compile-time debugger flag (currently unsupported on the Linux-first CLI path)
jai-compiler -debug_for <file.jai> recognize the for_expansion debugger flag (currently unsupported on the Linux-first CLI path)
jai-compiler --lsp start the LSP server mode
jai-compiler --help show this help message
Examples:
jai-compiler examples/hello.jai
jai-compiler examples/hello.jai --run
jai-compiler project.jai --run --module-param Build.MODE=release
jai-compiler examples/hello.jai --llvm -o hello
jai-compiler examples/hello.jai --llvm --llvm-obj