Skip to content
Projects

About

Fid: a self-hosted systems language with ownership, effects and compiler-checked safety rules. Native Windows and Linux executables with no C toolchain.

Self-hosted

How these counts are measured

36 stars0 Forks +1 in 24h

Measured star growth

in 24h
+1
in 7 days
Collecting history
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.md

Original

Fid — a systems language that checks what it promises

Borrow checking without lifetime annotations, capability grants on imports, effect tracking.
Its compiler, Fides, is written in Fid and builds itself to a byte-identical fixpoint. No LLVM. No GC.

Try it in your browser Install Documentation

CI Release License: MIT Discussions

Taste · What it catches · Install · Toolchain · Platforms · How it works · Status · Contributing


Thirty seconds of Fid

// hello.fd
fn main() {
    val name = "world";
    var total = 0;

    for i in 1..=100 {
        total += i;
    }

    println(f"Hello, {name}! total = {total}");
}
fid run hello.fd                 # interpret it: no build step
fid emit hello.fd -o hello.exe   # native executable, written by the compiler itself
fid ccompile hello.fd -o hello   # or through C, for every other target

val is immutable, var is mutable, types are inferred, and f"..." strings are part of the language. If you know Rust, Go, Zig or C, you can read Fid today: what carries over and what differs.

What the compiler refuses

Three real programs and what fid says about each (messages shortened to fit).

A loop cannot change what it walks

var v: Vec<i64> = Vec::new();
v.push(1);
for x in v {
    v.push(x);
}
error[E080]: borrow error in
main: cannot change v while a
`for` loop iterates over it

A module only gets what you grant

// logger.fd: pub fn log_line(s: str)
// { println(s); }
use logger with { FS };

fn main() -> i64 {
    log_line("started");
    return 0;
}
error: Capability error:
'println()' requires 'IO'
capability (not granted to
module 'logger')

A pure function stays pure

// helper() calls println
fn pure_sum(a: i64, b: i64)
    -> i64 !{} {
    return a + b + helper();
}
error[E110]: Effect error:
function 'pure_sum' has
inferred effect '!IO'

Every message is explained on the Compiler Errors page.

Why Fid

No lifetime annotations References are second-class: they cannot be stored or returned from a local, so there is nothing to annotate. Assignment copies; nothing moves out from under you.
Capabilities on imports use lib with { IO } and the compiler rejects that module's calls to the network or filesystem. Your use lines show what can touch what.
Effects in signatures !IO, !Net, !{}: inferred across the call graph, and under-declaring is a compile error. Handlers are resumable.
21 safety rules, each with a test that must fail @no-alloc, @bounded-stack, @constant_time, @secret and more. fid qualify writes the evidence as JSON.
Checks that stay on Bounds, integer overflow and double frees panic in every build, not only in debug.
No macros comptime runs ordinary Fid code at compile time, with reflection over types.
No LLVM fid emit encodes machine code and writes Windows and Linux executables itself: no assembler, no linker, no C compiler.
Self-hosted About 369K lines of Fid compile themselves. The 3-stage release bootstrap checks they rebuild to byte-identical output (last reached Nov 28, for v0.8.7-unstable); a self-compile to C takes 44 s (Nov 27).

Install

Windows. Download Fid-Setup-0.8.7.exe (older versions on the releases page). It puts fid.exe, ark, scribe, veil and the frozen Rust compiler fidesc on your PATH with the standard library beside them. The installer is not code-signed yet, so Windows will ask you to confirm. fid ccompile needs a C compiler on PATH (zig cc, gcc, clang or tcc); fid run and fid emit need none.

Linux and macOS, or from source anywhere. You need git, Rust and a C compiler (zig cc 0.16 is the tested one):

git clone https://github.com/pledgeandgrow/fid && cd fid
cargo build --release                          # the Rust bootstrap compiler and tools
RELEASE=1 CC="zig cc" ./scripts/bootstrap.sh   # builds fid in 3 stages and checks the fixpoint
./release/fid run tests/bootstrap/hello.fd

Stage 0 is a pinned self-hosted fid: bootstrap.sh downloads it from the stage0 release and checks its hash (scripts/stage0-fetch.sh). Binaries are published there for Windows x64 and ARM64, Linux x64 and ARM64, and macOS x64 and ARM64. The Windows ARM64, Linux ARM64 and macOS ones were cross-built and pinned on Nov 26–27 and have not yet built fid in CI. On a host with no pinned binary, it falls back to the Rust compiler, and that cold start stops at stage 2: a fid built by fidesc runs out of memory compiling the whole tree (known bug 2g.79). There, set STAGE0 to a self-hosted fid built elsewhere.

Nothing to install. The playground runs in your browser.

Editor support is in editors/: configurations for VS Code, Neovim, Helix, Emacs and Sublime, and a Zed extension with a Tree-sitter grammar. fid lsp speaks the Language Server Protocol (references, rename, signature help, inlay hints, code actions, formatting), checked by scripts/tl/lsp_*.py. The CI job that starts Neovim, Emacs and Helix against it has not passed yet.

The toolchain

One binary, fid, is the compiler, interpreter, test runner, formatter, linter and language server.

Command What it does
fid run file.fd Interpret a program. --leaks reports memory never freed
fid emit file.fd -o out Native executable with no other tools. --target x86_64-linux, aarch64-linux or riscv64-linux for Linux, universal for a macOS fat binary; --bare/--boot bare metal, --uefi a UEFI image
fid ccompile file.fd -o out Through C; --target cross-compiles with zig cc
fid wasm file.fd WebAssembly/WAT, no C compiler
fid check file.fd Type, borrow and effect checks only
fid explain-error E044 What an error code means, with an example and the fix
fid fix file.fd Apply the compiler's suggested fixes
fid test file.fd Run every test_* function, each in its own process
fid fuzz file.fd Run its fuzz_* functions on generated inputs
fid fmt / fid lint Format; unused code and unwrap() outside tests
fid audit file.fd List every unsafe block the program reaches
fid qualify file.fd Safety evidence as JSON: rules, their tests, annotated functions
fid explain file.fd Which run-time checks were removed or kept, and why
fid debug file.fd Interactive debugger (breakpoints, stepping, printing values)
fid lsp Language server over stdio

Beside it: ark (packages: a path, a git repository, or the pacts index — fid ark add textkit installs the first published pact), scribe (documentation from /// comments) and veil (coverage). The full list is in the CLI reference.

Where it runs

Platform Interpreter Through C Native (fid emit)
Windows x64 🟢 🟢 🟢
Linux x64 🟢 🟢 🟡
Linux ARM64 🟡 🟡 ¹ 🟡 ¹
Linux RISC-V ⚪ 🟡 ¹ 🟡 ¹
macOS x64 + ARM64 ⚪ 🟡 ⚪
WebAssembly 🟡 🟡
Bare metal x86-64 🟡 ²

¹ Programs built for the target and run under QEMU. ² Multiboot kernels booted and verified under QEMU in CI (bare-metal.yml, last green Nov 22). macOS: Mach-O executables build from any host, and CI runs the suite on Apple runners (the macos-arm64 lane of tier1.yml, and macos-native.yml for native executables), but neither has passed yet, so nothing has been confirmed on a Mac. Only Windows x64 was checked on the 0.8.7 compiler; no CI lane has passed since Nov 21 (see Honest status).

🟢 supported · 🟡 partly tested · ⚪ experimental. Details and test counts: platforms.

How it works

flowchart LR
    S([main.fd]) --> L[Lexer] --> P[Parser] --> C[Checks<br/>types · borrows · effects]
    C --> M[Monomorphizer] --> IR[SSA IR<br/>optimizer]
    IR --> I[Interpreter<br/>fid run]
    IR --> CB[C backend<br/>fid ccompile]
    IR --> N[Native emitter<br/>fid emit]
    CB --> CC[Any C compiler]
    N --> EXE([PE, ELF and Mach-O executables])

One front end and one IR, three ways out. The native emitter has its own instruction encoders and register allocator, so no assembler or linker is involved.

The compiler checks itself as hard as it checks your code:

  • Fixpoint. Stage 2 and stage 3 of the bootstrap must produce byte-identical output on every release build.
  • Proved rewrites. The optimizer's 27 integer rewrite rules and the e-graph's rewrites are proved with z3 at 8, 16, 32 and 64 bits: 253 obligations, all proved (Nov 28, with the 0.8.7 compiler).
  • Checked encoders. The instruction encoders are compared with clang's assembler across 1,200 forms, with no mismatch (Nov 28).
  • Conformance. 1,618 programs each check one rule of the language reference (§1–§13); all 1,618 pass on run (Nov 28).

More in verification and the contributor walkthrough.

Standard library

403 modules, written in Fid. A sample:

Area Modules
Core and collections core, vec, collections, string, rc, arena, iter, sort
Text and data json, toml, yaml, csv, regex, unicode, protobuf, cbor
Network http, http2, http3, quic, net, dns, ws, grpc, ssh, webrtc, mqtt
Security crypto, tls13, x509, sha512, ed25519, x25519, wireguard, pqc, hpke, typed_strings, privacy
Databases sqlite, postgres, mysql, mongodb, redis, db, sql_builder
Concurrency task, channel, sync, parallel, async
Numbers and models math, bigint, decimal, tensor, simd, infer, safetensors, bpe
Industrial and energy modbus, opcua, iec104, iec61850, dnp3, scada, plc, iso15118, matter
Automotive and robotics can, ecu, mavlink, ros2_msg, dds, kalman, planner, lidar
Systems and embedded fs, process, mmap, elf, pci, uart, virtio, nvme, ext4, gpio, i2c, spi
Games and graphics ecs, physics, mesh, gltf, tilemap, shader, sdl, vulkan, d3d12, webgpu
Finance money, banking, quant, decimal

Signatures for every module: API reference.

Honest status

Fid is young and moving fast.

  • Releases: the newest is the v0.8.7-unstable prerelease (Nov 28, commit e1115799). Its fid.exe comes from the 3-stage release bootstrap with the fixpoint checked, the first such package since Nov 21 (0.8.1 to 0.8.6 were one-stage builds). The first published build, Sep 9, was tagged v1.0.0 and is now listed as 0.7. The stable 1.0 is planned for December. fid version prints fid 0.8.7-unstable; earlier installers printed fid 1.0.0+dev. The installer is not code-signed.
  • Generated code is slower than Rust's. These are the Nov 17 runs on a busy Windows machine, against Rust, Zig, C++ and Go.
    • Through C:
      • level with the fastest on a small compiler and on JSON (within 15%);
      • faster than Rust and Go on binary-trees;
      • 1.2x behind on hashing, 1.5x on regex, 2–4x on string building, 3x on file reading and 5x on sorting;
      • 11–18x behind on pidigits, where its big integers are slow.
    • Natively (fid emit): slower than through C on every program but pidigits. Its executables were the smallest in the table (40 KB for hello, against 123 KB for Rust) and started as fast as Zig's; the runtime has grown since, and a hello from the 0.8.7 compiler is 137,629 bytes.
    • Benchmarks, losses included.
  • The package index is just starting. ark installs from a path, a git repository or the pacts index (fid ark add textkit); textkit is the only pact published so far. The CI steps that install from the index on Linux, Windows and macOS have not passed yet.
  • The fixpoint was last verified on Nov 28, 2026: for v0.8.7-unstable, stage 2 and stage 3 emitted identical C (142,939,506 bytes) on the ~369K-line tree of e1115799. Before that, Nov 21; the builds between (Nov 25, Nov 27, v0.8.5/v0.8.6-unstable) were one stage from a self-hosted fid.
  • The whole test suite on each backend.
    • Nov 28 compiler (v0.8.7): the whole bootstrap suite (2,433 programs) was not rerun; several checks are stricter now, so some programs that compiled before may be rejected. What was run: the 302 BG258–BG490 regression tests on run, ccompile, emit and --nat (all pass), conformance 1,618 of 1,618 on run, the leak gate 11 of 11, fid check compiler/main.fd with no errors. Linux targets were not run.
    • Interpreter (Nov 25): 1,897 of 1,983 pass on run, with fid as the compiler. 82 of the failures fail the same with the earlier compiler; 4 are timeouts.
    • Native, both backends (Nov 27, the first such run): 2,011 of the 2,056 programs in tests/bootstrap pass on emit and on --nat.
      • 38 fail on both: 13 don't compile, 8 hit PE generation errors, and the rest are bare-metal or boot programs and tests that need SDL2 or a C header.
      • 7 fail on --nat only.
      • Details in the LLVM roadmap, WP14.
    • C: not rerun.
  • CI is red.
    • None of the runs GitHub still has for ci.yml (91), tier1.yml (92) or macos-native.yml (22), going back to Nov 21, has passed (Nov 28).
    • Most jobs stop while building fid, on the stage-0 binaries and the memory of GitHub's runners.
    • bare-metal.yml and pages.yml last passed on Nov 22.
    • On the v0.8.7 commits (e1115799, 95f10537) the workflows failed too.
    • The checks above were run by hand on a Windows machine.
  • Bugs. The bugs roadmap, filled by the whole-repo reviews of Nov 22, Nov 24 and Nov 27, has 490 entries (Nov 28): 453 done, 37 partly done, none open. Of the 233 from the Nov 27 reviews (BG258–BG490), 223 are fixed and verified and 10 partly done: some array copies and escaping closures still leak (BG369, BG384, BG431), and the rest are in the installer, the stage-0 pin, release.yml, a race, a failure path and a 512 MiB input that could not be exercised.
  • Not for safety-critical use. fid qualify produces evidence for review, not a certification.

The details: status · known bugs · roadmap.

Learn

The Fid Book First program to a network service
University course 13 weeks of lecture notes: memory safety, effect systems, capability security, systems programming; a lab per week that opens in the playground
Coming from Rust · Go · Zig · C · Python What you already know, mapped onto Fid
Language reference Every rule, with the compiler function that enforces it
Cookbook Files, JSON, HTTP, tasks
Examples A JSON parser, an HTTP server, a mini compiler, a neural network, a game loop
INDEX.md A map of every document and compiler module

Repository layout

compiler/    the compiler, in Fid: 65 modules, about 369K lines
stdlib/      the standard library: 403 modules
src/         the earlier compiler in Rust, frozen; it builds stage 1 and runs the test harness
tests/       bootstrap (2,433 programs), conformance (1,622), selfhost (47),
             plus projects, verify, nattools, tooling and leak checks
examples/    twelve complete programs
tools/       ark, scribe, veil and friends, written in Fid
docs/        book, guides, reference, proposals, roadmap, verification
editors/     VS Code, Neovim, Helix, Emacs, Sublime, Zed
installer/   the Windows installer
bench/       benchmark programs in Fid, Rust, Zig, C++ and Go
scripts/     bootstrap, cross-target tests, fuzzing, verification

Contributing

Contributions are welcome, from a test program to a compiler change.

  1. Read CONTRIBUTING.md and, before touching compiler/*.fd, AGENTS.md and the compiler internals.
  2. Build with the two commands under Install.
  3. Keep a change small: one fix, one test. RELEASE=1 ./scripts/bootstrap.sh must still reach its fixpoint.
  4. Language changes start as a proposal.

Questions go to Discussions, bugs to issues, and security problems privately through SECURITY.md. Miscompile reports get priority.

Questions people ask

How is Fid different from Rust?

No lifetime annotations: references cannot be stored or returned from a local. Assignment copies instead of moving. No macros; comptime instead. Capability grants and effect annotations are built in. Fid is younger, its package index is just starting, and its generated code is slower. Full comparison.

How is Fid different from Zig?

Both have comptime and their own backends. Zig checks bounds and overflow in its safe build modes and leaves the rest of memory safety to the engineer; Fid checks borrows and reference escapes at compile time and keeps bounds and overflow checks in every build. Full comparison.

Why build a toolchain without LLVM?

Control. The IR carries Fid's own semantics (regions, effects, capabilities), and there is no external toolchain to pin. The cost is optimizer maturity: generated code is slower than LLVM's today.

Is it production-ready?

Not yet for most teams. Pilot it on a bounded tool and read the status page first.

What do the names mean?

Fid is the language. Fides, the Latin word for trust, is its compiler. fid is the command you type.

Community and licence

Website · Discussions · Changelog · Code of conduct · Support

Fid is maintained by Mehdi Berel at Pledge & Grow and released under the MIT licence.

If Fid is useful to you, a star helps other people find it.

Explore related projects

Loading…