Getting Started with Gat

This guide walks you through setting up the Gat compiler, writing your first program, and understanding the core toolchain workflows.


1. Quick Installation

Download the latest pre-compiled archive for your OS from Releases:

  1. Extract the archive:
    • On Windows: Extract gat-v0.1.0-windows-x64.zip to a folder (e.g. C:\tools\gat).
    • On Linux: Extract gat-v0.1.0-linux-x64.tar.gz (tar -xzf gat-v0.1.0-linux-x64.tar.gz -C ~/.local/).
  2. Add bin/ to your PATH:
    • The archive contains bin/gat (the CLI driver) and bin/gatc (the core compiler).

Option B: Clone and Verify from Source

Clone the repository:

git clone https://github.com/DanielcoderX/gat.git
cd gat

Run the automated test and bootstrap suite:

# On Windows
.\test.ps1

2. Your First Program

Create a file named hello.gat:

// hello.gat
fn main() -> i64 {
    print("Hello from Gat!\n");
    return 0;
}

Running Directly

You can run any .gat file directly with the CLI driver:

gat run hello.gat

This compiles the code into a temporary native executable, runs it, forwards arguments and exit codes, and cleans up automatically.

Compiling to Native Executable

To produce an optimized, standalone binary:

gat build hello.gat -o hello.exe

Run the resulting binary:

.\hello.exe

3. Cross-Compiling for Linux

Gat includes built-in dual backends. Without installing cross-compilers or GCC toolchains, you can emit raw Linux ELF64 binaries directly:

gat build hello.gat -o hello_linux --target=linux

Transfer hello_linux to any x86-64 Linux server or WSL distribution:

chmod +x hello_linux
./hello_linux

Output:

Hello from Gat!

4. Managing Projects with gat CLI

Gat includes an integrated package and project manager:

Create a New Project

gat init my_app
cd my_app

This generates:

  • gat.mod: Project manifest specifying name, version, and dependencies.
  • src/main.gat: Default entrypoint.

Build and Run Projects

gat build
gat run

5. Next Steps


Gat Programming Language © 2026. Released under the MIT License.

This site uses Just the Docs, a documentation theme for Jekyll.