Getting Started

Logos ships as a native compiler (logosc), a standard library, and a runtime. This page gets you from a fresh checkout to a running program.

Prerequisites

Building logosc is a native toolchain build. You’ll want:

  • A C/C++ toolchain (Clang recommended) and CMake ≥ 3.20
  • Ninja for fast incremental builds
  • LLVM/MLIR development libraries (the compiler lowers through MLIR to LLVM)

The compiler pipeline covers parse, sema, borrow checking, monomorphization, MLIR generation, and LLVM lowering. Building against a matching LLVM/MLIR is the main prerequisite — see the in-repo docs for the exact supported version.

Build the compiler

cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build

This produces the compiler binary at build/src/compiler/logosc.

Compile and run a program

Point logosc at a .logos source file and give it an output name:

build/src/compiler/logosc examples/writ_round_trip.logos -o round_trip
./round_trip

Logos compiles ahead-of-time to a native executable — there is no VM or interpreter in the run path.

Your first program

Create hello.logos:

package hello;
use logos.std.io;

fn main() -> i32 {
    println("Hello from Logos!");
    return 0;
}

Compile and run it:

build/src/compiler/logosc hello.logos -o hello
./hello

Run the test suite

Logos gates merges on a large executable test suite — around 800 passing tests plus ~165 diagnostic tests:

cd build && ctest --output-on-failure

Where to next