Skip to content

SailfinIO/sailfin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2,650 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sailfin

Sailfin

A self-hosted systems language with compile-time capability checks.

Website · Install · Language Spec · Roadmap · Blog · llms.txt

Latest release License: GPL v2 GitHub stars

Status: Sailfin is pre-1.0 and under active development. The native compiler is self-hosted and the runtime is written in Sailfin. The current backend still lowers through LLVM and links with the platform toolchain; LLVM/clang independence is a project goal, not the current shipping state. For the exact feature matrix, see docs/status.md.

What is Sailfin?

Sailfin is a systems programming language built around explicit capabilities. Functions spell the effects they use, such as ![io], ![net], or ![clock], and capsules declare which capabilities they require. The compiler checks both levels, so capability use is visible in source and rejected when it exceeds the declared surface.

The long-term goal is a production-ready compiler, runtime, and capsule ecosystem with a capability-sealed runtime. The repository is already self-hosting: the compiler is written in Sailfin, compiles itself from a released seed, and links a Sailfin runtime from runtime/sfn/ and runtime/prelude.sfn.

Repository Layout

  • compiler/src/ - the Sailfin compiler, written in Sailfin.
  • runtime/ - the Sailfin runtime capsule, including platform adapters, memory, strings, process, clock, and concurrency support.
  • capsules/sfn/ - standard library capsules such as strings, json, fs, http, net, cli, test, and numeric/ML-oriented capsules.
  • compiler/tests/ - unit, integration, and end-to-end compiler tests.
  • examples/ - small language and library examples.
  • docs/ - engineering docs, status matrices, proposals, performance notes, and RCAs.
  • site/ - the public website and user-facing language documentation.
  • tools/mcp-server/ - MCP integration backed by compiler diagnostics.

Current Capabilities

The current self-hosted compiler supports the core language: functions, structs, enums with payloads, interfaces, type aliases, arrays, generics with partial inference, closures with capture, pattern matching, Result<T, E> and ?, unsafe / extern fn, atomic intrinsics, and explicit numeric casts.

The effect system is enforced for io, net, and clock, including cross-module propagation and capsule capability checks. Ownership enforcement is active for the owned-buffer family and affine / linear bindings, with broader borrow checking still in development.

The tooling includes:

  • sfn build and sfn run
  • sfn check with structured JSON diagnostics
  • sfn fmt --check / sfn fmt --write
  • sfn test with filtering, snapshots, parallel execution, and a per-test binary cache
  • sfn init, sfn add, sfn lock, sfn package, and sfn publish

Structured concurrency is available as a v0 surface: routine, channel, spawn / await, and parallel work end-to-end, with typed channel constructors, richer result collection, and the post-1.0 async I/O runtime still planned.

For the detailed current-state matrix, use docs/status.md. For language semantics, use the specification.

Example

struct User {
  id:   int;
  name: string;
}

fn greet(user: User) -> string ![io] {
  let msg = "Hello, {{ user.name }}!";
  print(msg);
  return msg;
}

test "greet produces correct output" {
  let u = User { id: 1, name: "Alice" };
  let result = greet(u);
  assert(result == "Hello, Alice!");
}

greet calls print, so it declares ![io]. If the annotation is removed, sfn check reports a compile-time effect error. If a capsule exposes code that uses io, its capsule.toml must include io in [capabilities].required.

Installing

Releases are published as per-OS/arch tarballs containing bin/sailfin (or bin/sailfin.exe on Windows). The installer defaults to the latest release and installs to ~/.local/bin on Linux/macOS, or %LOCALAPPDATA%\sailfin\bin on Windows.

Linux / macOS

curl -fsSL https://raw.githubusercontent.com/SailfinIO/sailfin/main/install.sh | bash

To pin a specific release:

curl -fsSL https://raw.githubusercontent.com/SailfinIO/sailfin/main/install.sh | VERSION=<version> bash

Windows PowerShell

irm https://raw.githubusercontent.com/SailfinIO/sailfin/main/install.ps1 | iex

To pin a specific release:

$env:VERSION = "<version>"
irm https://raw.githubusercontent.com/SailfinIO/sailfin/main/install.ps1 | iex

Release assets follow the pattern sailfin_<version>_<os>_<arch>.tar.gz. Set GITHUB_TOKEN to raise the GitHub API rate limit if release lookup is throttled.

Building From Source

The compiler self-hosts from a released seed binary. make compile fetches the seed if needed and builds build/bin/sfn.

make compile          # Build the self-hosted native compiler
make test             # Run the test suite with an existing build
make check            # Build as needed, build seedcheck, and run the full gate
make install          # Install to PREFIX/bin, defaulting to ~/.local/bin
make clean            # Remove packaged artifacts under dist/

After compiling:

build/bin/sfn --version
build/bin/sfn run examples/basics/hello-world.sfn
build/bin/sfn check compiler/src/

If installed:

sfn --version
sfn run examples/basics/hello-world.sfn
sfn fmt --check compiler/src/ runtime/

Development Notes

  • The current backend emits Sailfin native IR (.sfn-asm), lowers to LLVM IR, and links with the platform toolchain.
  • The compiler has deterministic self-hosting coverage: the full verification gate checks that successive compiler stages produce byte-identical LLVM IR.
  • docs/status.md is the source of truth for shipped, partial, and planned behavior.
  • User-facing docs live in site/src/content/docs/ and are published at sfn.dev/docs.
  • The public roadmap is generated from GitHub milestones at sfn.dev/roadmap.

Contributing

See CONTRIBUTING.md for contribution guidelines. Groomed work is tracked in the issue tracker, and the roadmap at sfn.dev/roadmap tracks the larger milestones.

About

A systems language with compile-time capability enforcement

Topics

Resources

License

GPL-2.0, Unknown licenses found

Licenses found

GPL-2.0
LICENSE
Unknown
COPYING

Contributing

Security policy

Stars

6 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors