A statically typed, design-by-contract programming language for
building fast, scalable, and maintainable systems.
Install - POSIX (Linux, MacOS, FreeBSD, etc...)
curl https://spectrelang.org/get.sh | sh
Install - Windows
irm https://spectrelang.org/get.ps1 | iex
Spectre features a contract system integrated into the language
grammar, an explicit allocatorized API for low-level control with no
implicit allocations, and
performance gains of up to 6x that of Zig and Rust in general
purpose tasks, primarily due to autovectorization, SIMD instruction injection
per-platform, and a highly optimized standard library. For DbC, the
programming language offers explicit control over which checks
survive into release builds through the use of the
guarded
construct, though in most cases contract verification is done at
compile time.
It features a contract system integrated into the language grammar.
Functions carry named preconditions and postconditions that
participate in compilation and, depending on their form, in the
generated binary. To accomodate for function-level contracts, there
is a type-level invariant system, wherein conditions in type
invariants are evaluated at compile time.
Spectre compiles to QBE IR which lowers to assembly. Windows is
supported via an MSVC backend, though can also work under MinGW,
Clang, and TCC (though TCC will always produce dynamically linked
binaries, thus is never the default). The QBE backend has been
forked for the purpose of optimizing Spectre's default code
generation further.
val netx = use("std/netx")
val allocators = use("std/allocators")
val stdio = use("std/stdio")
fn hello(_: ref netx.Request, res: mut ref netx.Response) void = trust {
netx.Response.json(
res,
\\{
\\ "header": "Greeting",
\\ "message": "Hello, world."
\\}
)
}
pub fn main() void = trust {
val ac: allocators.HeapAllocator = @zeroed
val app: mut netx.WebServer = netx.WebServer.new[_](ac, 8080 as i32)
if app == none {
stdio.puts("Failed to start server")
return
}
netx.WebServer.get(app, "/", hello)
netx.WebServer.serve(app)
}
A complete CHIP-8 emulator using SDL2 for display and input.
Implements the full instruction set including the original
COSMAC VIP opcodes, with configurable CPU speed for
compatibility across ROM sets.
A 3D map editor with an intuitive UI, support for Quake WAD
imports, and Valve 220 .map file imports. Along with export to
glTF, GLB, and WaveFront OBJ 3D formats.