Skip to content

Compiler CLI

jiang compiles Jiang source files. The current compiler can emit LLVM IR, object files, or link an executable through the host C compiler. Release packages retain jiangc as a compatibility link for existing scripts; new commands should use jiang.

jiang --version
jiang --help

--version prints the Jiang compiler version, host target, and LLVM version.

jiang --check tests/samples/minimal.jiang

This parses, resolves, and type checks the program without emitting LLVM IR, an object file, or an executable.

jiang --emit-llvm tests/samples/minimal.jiang

By default, LLVM IR is written to standard output. Use -o to write it to a file:

jiang --emit-llvm tests/samples/minimal.jiang -o minimal.ll
jiang --emit-obj tests/samples/minimal.jiang -o minimal.o

This stops after object generation and does not link an executable.

Without an explicit --emit-* mode, jiang creates a temporary object file and asks the host cc to link an executable:

jiang tests/samples/minimal.jiang -o minimal

Then run:

./minimal
echo $?

jiang defaults to debug mode:

jiang --mode debug main.jiang -o main

Release mode enables LLVM optimization:

jiang --mode release . -o app

Use --jobs when you need to cap compilation concurrency:

jiang --jobs 1 . -o app

Use --target for LLVM IR or object output:

jiang --target x86_64-unknown-linux-gnu --emit-obj main.jiang -o main.o

Hosted executable linking is native-toolchain only. Release packages support macOS arm64 and Linux x86_64; Linux hosted programs use the system libc. Linux aarch64, Wasm, WASI, and Windows targets currently have narrower or experimental output boundaries, and Linux no-libc executable support is not yet available.

Use --linker to select the program used for final linking:

jiang --linker /usr/bin/cc main.jiang -o main

Pass extra linker arguments with repeated --link-arg options:

jiang main.jiang -o main --link-arg -lm

Hosted builds use the target host’s C runtime and native linker toolchain. Release compilers include the LLVM libraries used by jiang, so running a packaged compiler does not require a separate libLLVM or liblld installation.

Run the package root generator or select a configured alias:

jiang generate .
jiang generate . --name models -o build/models

See reflection and generation for entry contracts, configuration, output replacement and caching.