Scaly

A compiled programming language whose memory is managed in regions the compiler infers: no garbage collector, no borrow checker, and no lifetime annotations in ordinary code.

A Tour of Scalyโ†’

Twelve short steps, each a program you can change and run โ€” right here in the browser.

The REPLโ†’

Type a line, see its value; definitions stay for the next one.

Installโ†’

One command on macOS, Linux and Windows; nothing else to set up.

The languageโ†’

The tutorial and the specification of the language, also as PDF.

What it is

Scaly compiles through LLVM to native code, checks that functions are pure, and runs a for loop in parallel when its body allows it โ€” with no parallel syntax at all. The compiler is written in Scaly and builds itself; so are its language server and the tool around it.

Try it in the browser

The tour and the REPL run the real compiler, built for WebAssembly, in your browser tab: nothing is sent to a server, and nothing needs to be installed. The first visit loads about 7 MB; a program compiles and runs in a few hundred milliseconds.

Start the tour ยท open the REPL

Install

macOS and Linux

$ curl -fsSL https://scaly.io/install.sh | sh

Windows (PowerShell)

> irm https://scaly.io/install.ps1 | iex

The installer puts three ready-made programs under ~/.scaly โ€” no sudo, no LLVM to install: scaly (the tool), scalyc (the compiler) and scalyls (the language server). It needs a C compiler for linking (clang; on Windows the Build Tools for Visual Studio, which it offers to install). Ready-made programs exist for macOS 26 on Apple silicon, macOS 15 on Intel, Ubuntu 26.04 on x86_64 and arm64, and Windows 10/11 on x86_64 and arm64; elsewhere the installer builds them from source. Details and other systems.

First steps
printf 'print("Hello, World!")\n' > hello.scaly
scaly run hello.scaly                  # compiled and run in process
scaly build hello.scaly -o hello       # a native program
scaly new myapp                        # a project with a test
scaly                                  # the REPL
A taste
define Shape union
(
    Rect: (w: f64, h: f64)
    Triangle: (base: f64, height: f64)
)

function area(s: Shape) returns f64
    choose s
        when r: Rect: r.w * r.h
        when t: Triangle: t.base * t.height / 2.0

function total(shapes: Vector[Shape]) returns f64
{
    var sum 0.0
    for s in shapes                     ; a reduction: runs on every core
        sum := sum + area(s)
    sum
}

var shapes Vector[Shape](3)
shapes.put(0, Shape.Rect((w: 2.5, h: 4.0)))
shapes.put(1, Shape.Triangle((base: 3.0, height: 1.5)))
shapes.put(2, Shape.Rect((w: 0.5, h: 0.5)))
print "total area: `total(shapes)`"    ; total area: 12.5

No semicolons, no return for the last value, and no annotations about where memory lives. Paste it into any step of the tour and run it.

An HTTP server

The standard packages include an HTTP/1.1 and HTTP/2 server; this one answers on port 8080 on every core:

package http 0.2.0

use http.Request.Request
use http.Response.Response
use http.Router.Router

procedure hello(req: ref[Request], mutable res: ref[Response])
    res.send_text("Hello, World!")

procedure greet(req: ref[Request], mutable res: ref[Response])
{
    let name req.param("name")
    let text "Hello, `name`!"
    res.send_text(text.as_slice())
}

var app Router.create(Page.allocate_page())
app.get("/", &hello)
app.get("/hello/{name}", &greet)
serve(app, 8080)
scaly build server.scaly --release -o server && ./server

Each request is handled in a region of its own, freed when the handler returns. Beside the standard library: http, https (TLS 1.3), h3 (HTTP/3), tls, json, compress, and clients for PostgreSQL, Redis, SQLite and SQL Server. More on the HTTP stack's page.

Learn Scaly
The tourThe language in twelve programs you run in the browser.
The tutorialFrom a first program to packages and production builds.
The specificationThe language end to end; its examples are executed by the test suite. As PDF.
VS CodeAn extension on the language server: diagnostics as you type, hover, go to definition, references, rename, completion. Source-level debugging through DWARF with lldb.
The sourceThe compiler, the standard library and the packages, MIT licensed.
Built with Scaly
Building from source

A checkout builds the toolchain from the committed seed, the compiler as LLVM IR. It needs LLVM 21 with its headers (Homebrew's llvm@21, Ubuntu's llvm-21-dev lld-21 clang) and a C compiler:

git clone https://github.com/rschleitzer/Scaly && cd Scaly
tools/build-from-seed.sh        # -> scalyc/build/scalyc, scaly, scalyls
tools/install.sh                # put it on your PATH
Questions and issues

Bug reports and questions are welcome as issues. Scaly is developed by one person; for a change larger than a fix, please open an issue first. A security problem goes privately, as SECURITY.md says. Scaly is MIT licensed.