This repository contains the compiler for the Spectre Programming Language.
Spectre is a statically typed, design-by-contract language aiming to offer low-level control, no hidden allocations, and compile-time-enforced correctness. The compiler is written entirely in Spectre itself.
Resources:
- Documentation
- Devlog
- Matrix
- Discord
- YouTube
- Visual Studio Code Extension
- Neovim Extension
- Language Server
- Debugger
- Version Manager
- Libraries and Ecosystem
Prerequisite: cmake
Run the following in the terminal (Linux/Mac):
curl https://spectrelang.org/get.sh | sh
Or in Windows PowerShell:
irm https://spectrelang.org/get.ps1 | iex
Then run to confirm installation:
spectre -v
Note
Linux and Windows targets use a self-contained freestanding runtime by
default, meaning no system libc, CRT, or Linux sysroot. Hosted builds remain
available with -runtime:hosted. Cross compilation from Linux to Windows, for example, is as simple as:
spectre app.sx -target:windows.x86_64 -o app.exe
This will produce app.exe, a 64-bit executable for Windows.
An example program is as follows:
val stdio = use("std/stdio")
pub fn main() void = {
val xs = [
"hello", "world", "this", "is", "a", "test"
]
for x in xs {
trust stdio.print("{s}\n", {x})
}
}
GPL-3.0-only - (C) Navid M. - 2026