Skip to content

Getting Started

This guide assumes jiang is installed and available on your PATH. If not, start with Installation.

Create hello.jiang:

Int add(Int a, Int b) {
    return a + b;
}

Int main() {
    print(add(40, 2));
    return 0;
}

A Jiang function always has a return type. The process entry point is main; print writes 42 and a newline, while return 0 indicates success.

jiang -o hello hello.jiang

Run it:

./hello
echo $?

The program prints 42, then echo $? shows the exit status 0.

Install the VS Code extension for completion, hover documentation, and navigation.

During language development it is often useful to inspect the generated LLVM IR:

jiang --emit-llvm hello.jiang

Use -o to write the IR to a file:

jiang --emit-llvm -o hello.ll hello.jiang

Jiang source is declaration-oriented. A small file usually contains type declarations, functions, and a main function:

struct Pair {
    Int left;
    Int right;
}

Int sum_pair(Pair pair) {
    return pair.left + pair.right;
}

Int main() {
    Pair pair = Pair(left = 20, right = 22);
    return sum_pair(pair);
}

Next, read the syntax overview and types guide.