Skip to content
spectrelangPublic

Latest commit

 

History

2,596 Commits

Folders and files

Repository files navigation

Spectre

License Status Stars

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:

Installation

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.

Example

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})
    }
}

License

GPL-3.0-only - (C) Navid M. - 2026

Releases

Sponsor this project

Packages

Contributors

Languages