* Documentation

Getting Started

Install Turf, write a .tr file, and compile/run your first program.

Your first Turf program

Create a file named hello.tr:

// hello.tr
int x = 5 + 3
printline(x)

Compile and run

If you have the turf compiler in your PATH:

turf hello.tr -o hello
./hello

The -o flag controls the output binary name. By default, Turf links and produces a native executable.

Emit LLVM IR (optional)

To write LLVM IR text instead of compiling to a native binary:

turf hello.tr -o hello --emit-llvm

This produces hello.ll.

Installation

You don’t need to build from source to start. Download the pre-built release binary for your OS/architecture (see the Turf repo README), extract it, and then use the included turf executable.

For example on macOS Apple Silicon:

tar -xzf turf-v0.4.0-macos-arm64.tar.gz

Build from source (optional)

If you prefer building the compiler locally, Turf expects LLVM + a modern C++ compiler (for example clang++):

./scripts/update_compiler.sh

Run the test suite (optional)

From the turf-lang repo root (after building the turf binary):

./tests/run_tests.sh