Compiler CLI
jiangc compiles Jiang source files. The current compiler can emit LLVM IR, object files, or link an executable through the host C compiler.
Version and Help
Section titled “Version and Help”jiangc --versionjiangc --help--version prints the Jiang compiler version, host target, and LLVM version.
Check Only
Section titled “Check Only”jiangc --check tests/samples/minimal.jiangThis parses, resolves, and type checks the program without emitting LLVM IR, an object file, or an executable.
Emit LLVM IR
Section titled “Emit LLVM IR”jiangc --emit-llvm tests/samples/minimal.jiangBy default, LLVM IR is written to standard output. Use -o to write it to a file:
jiangc --emit-llvm tests/samples/minimal.jiang -o minimal.llEmit an Object File
Section titled “Emit an Object File”jiangc --emit-obj tests/samples/minimal.jiang -o minimal.oThis stops after object generation and does not link an executable.
Link an Executable
Section titled “Link an Executable”Without an explicit --emit-* mode, jiangc creates a temporary object file and asks the host cc to link an executable:
jiangc tests/samples/minimal.jiang -o minimalThen run:
./minimalecho $?Debug and Release Modes
Section titled “Debug and Release Modes”jiangc defaults to debug mode:
jiangc --mode debug main.jiang -o mainRelease mode enables LLVM optimization and uses package-level object organization when compiling a package directory:
jiangc --mode release . -o appFor single-file input, release mode still compiles that source file directly.
Linker Options
Section titled “Linker Options”Use --linker to select the program used for final linking:
jiangc --linker /usr/bin/cc main.jiang -o mainPass extra linker arguments with repeated --link-arg options:
jiangc main.jiang -o main --link-arg -lmRuntime Boundary
Section titled “Runtime Boundary”The current minimum runtime boundary still uses the host C runtime for low-level services, mainly:
mallocfreeprintfabort
This is expected during the current compiler development stage.