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.
pacman -S meson clang ninja llvm readline
Debian
apt install meson clang libreadline-dev
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
This installs:
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
Next steps
Now that Quadrate is installed, continue to Hello World to write your first program.
The learn guide covers:
- The Stack - Core concepts of stack-based programming
- Functions - Defining and calling functions
- Structs - Working with structured data
- Error Handling - Handling errors properly
- Modules - Creating reusable modules
Reference:
- Standard Library - Available modules and functions
- Toolchain - All available tools