Getting started

This guide will help you install Quadrate and write your first program.

Prerequisites

Quadrate requires the following build tools:

  • Meson (build system)
  • Ninja (build backend)
  • Clang/LLVM (compiler toolchain)

Installing dependencies

Note: Arch Linux, Debian and Haiku are currently the only tested and supported platforms. Other platforms may work but are untested.

https://archlinux.org/ Arch Linux

pacman -S meson clang ninja llvm readline

https://www.debian.org/ Debian / Ubuntu

apt install meson ninja-build clang llvm-dev libreadline-dev

https://www.haiku-os.org/

pkgman install meson llvm21 llvm21_clang readline_devel

Installation

From source

Clone the repository and build:

git clone https://git.sr.ht/~klahr/quadrate
cd quadrate
make release
make install

From floppy disk

Get Quadrate on a real 1.44 MB floppy disk:

Each floppy contains the complete source code and pre-built binaries, compressed to fit on 1.44 MB. Shipping to Europe only.

Default locations

  • Binaries to /usr/bin/
  • Libraries to /usr/lib/
  • Standard library to /usr/share/quadrate/

Haiku specific locations

  • Binaries to /boot/home/config/non-packaged/bin/
  • Libraries to /boot/home/config/non-packaged/lib/
  • Standard library to /boot/home/config/non-packaged/data/quadrate/

Verifying installation

quad version

To verify everything works, try running a quick test:

echo 'fn main() { "Hello!" print nl }' | quad run -

Using quad

The quad command is your main interface to Quadrate. It provides a unified way to build, run, test, and format your code:

quad run hello.qd      # Compile and run
quad build hello.qd    # Compile to binary
quad fmt hello.qd      # Format code
quad lint hello.qd     # Check for issues
quad test              # Run tests
quad repl              # Start interactive shell

For most tasks, quad is all you need. It automatically finds your source files and handles the details.

See Toolchain for documentation on all available tools including the compiler (quadc), formatter (quadfmt), linter (quadlint), and more.

Editor support

Neovim

Tree-sitter grammar and LSP support: quadrate.nvim

Visual Studio Code / Code - OSS

Syntax highlighting and LSP support: quadrate-vscode

Troubleshooting

LLVM version errors

If you see errors about LLVM not being found, ensure you have LLVM 14 or higher installed. On Debian/Ubuntu, install llvm-dev (or a specific version like llvm-18-dev).

Ninja not found

Make sure ninja (or ninja-build on Debian/Ubuntu) is installed. Meson requires Ninja as its build backend.

C++20 compilation errors

Quadrate requires a compiler with C++20 support. Use GCC 10+ or Clang 10+. If your system's default compiler is older, set CXX before building:

CXX=clang++-18 make release

Permission denied on install

On Linux, use sudo make install to install to system directories. On Haiku, make install works without sudo.

Next steps

Now that Quadrate is installed, continue to Hello World to write your first program.

The learn guide covers:

Reference: