* Documentation

Project Structure

Layout of the turf-lang repository: compiler sources, standard library, docs, and tests.

The Turf compiler is written in C++20 and uses LLVM 22 as its backend, with llama.cpp vendored as a submodule for the --smart diagnostics pipeline.

Root directory

Header files (include/)

The compiler is split across many small, single-responsibility headers rather than a few large ones. Notable groupings:

Source files (src/)

Mirrors the header split, with large subsystems further divided by concern rather than kept in one file:

Standard library (lib/std/)

One directory per module family, each an ordinary .tr source tree with no compiler special-casing: core/ (prelude — int/double/bool/char/strings/array), collections/ (List/Stack/Queue/Map/Set), io/, mem/, math/, time/, random/, fs/, http/, json/, os/, testing/. See Standard Library for the full per-module breakdown.

Docs (docs/)

Tests (tests/)

Organized by compiler stage and feature area (01_syntax, 02_resolver, 03_typechecker, 04_control_flow, 05_arrays_pointers_ffi, and onward through the full feature set — structs, enums, generics, error handling, state machines, stdlib modules). scripts/test_runner.sh runs the full suite from the repo root.

Scripts (scripts/)