Skip to content

About Fid

A systems language that checks what it promises

Fid is built from first principles, every layer from parser to machine code written for it, with no LLVM. It aims to be safer than C and simpler than Rust. Its generated code is not yet as fast as either.

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

The name is short for Fides, the Latin word for trust and good faith. In Roman mythology, Fides was the goddess of good faith and honor (Greek: Pistis), depicted as a draped woman or as two joined hands. A language built on compile-time guarantees could hardly be named anything else.

The project in numbers

8
Design pillars
2
Supported platforms
~210K
Lines of compiler, in Fid
0
LLVM dependencies

The eight pillars

Supported: Windows x64 and Linux x64. Native builds need no other tools; C builds need a C compiler.

Originality

Fid combines a borrow checker without lifetime annotations, effect tracking and handlers, capability grants on imports, and comptime metaprogramming. It is a new design, not Rust with different syntax.

Security

Rule out bug classes in the compiler: capability grants on imports, borrow and escape checks, bounds and overflow checks at run time, and an effect system that makes IO and network use visible. Coverage is partial today; the Feature Status page says where.

Performance

Custom IR and codegen with no LLVM, aimed at fast compiles and at optimizations a generic backend cannot see. Not there yet: the native backends have an optimizer and a register allocator, and their code is still slower than code built through C.

Memory safety without the pain

No lifetime annotations: references are second-class, and borrow and escape rules are checked at compile time. Bounds and integer overflow are checked at run time. The compiler frees locals it can prove are finished; there is no GC.

Power & flexibility

Raw pointers and C calls inside unsafe, inline assembly on the native Windows backend, @repr(C) and @packed layouts, and explicit as casts for narrowing.

Adoption

C interop for gradual migration, familiar Rust-like syntax, single-binary output, an interpreter for a fast edit-run loop, and a language reference that names the compiler function behind every rule.

Custom everything

Lexer, parser, typechecker, IR, optimizer, codegen, linker, stdlib, allocator: if Fid depends on it, Fid builds it. The exceptions are a C compiler, used by the C backend and the bootstrap, and the system DLLs (kernel32, msvcrt) a native Windows executable imports.

Innovation

SIMD and tensor types for AI, @realtime functions that cannot allocate or block, and 17 safety rules whose evidence fid qualify reports. Bare-metal output is experimental: fid emit --bare writes an x86-64 Multiboot kernel that boots under QEMU.

Non-negotiable design principles

The rules that decide every design question, and the anti-patterns they forbid.

  • 1

    Safety by construction, not by convention

    If a bug class can be eliminated at compile time, it must be. Relying on developer discipline to prevent a class of bugs is an anti-pattern, not a policy.

  • 2

    Zero hidden costs

    If you can't see it in the source, it doesn't happen: no hidden allocations, no exceptions, no implicit casts, no GC, no VM, and no hidden dependencies.

  • 3

    One way to do things

    One metaprogramming system (comptime), one error-handling story (Result + ?), one reference model (second-class references checked by the borrow checker).

The self-hosted compiler

Fid is developed in phases, and each one ships working software. The self-hosted compiler is now the primary development path.

  • The bootstrap compiler (done)

    A compiler in Rust with an interpreter, a C backend, direct PE and ELF64 emission, experimental WASM, SPIR-V, ARM64 and RISC-V backends, watch mode and an LSP. It is now frozen: it builds stage 1 of the bootstrap and runs the test suite.

  • Self-hosting (done)

    The compiler is rewritten in Fid (72 modules, about 210K lines) and is the release compiler. It builds itself through C to a byte-identical fixpoint, checked on every release build.

  • Effects, resumed (done)

    Effect handlers gained real continuations: do performs an effect, the handler calls resume. Structured concurrency (spawn scope) and scope cancellation landed in the same push.

  • Deepening the language

    Landed: generics with inference, bounds and turbofish, if/match as values, @cfg, owned and borrowed strings, one ownership rule with value semantics for collections, @send checks on spawn, 17 safety rules with fid qualify evidence, a register allocator, native async and native Linux executables. Next: a full suite run with fid as the compiler under test, faster generated code, macOS.

Community

Get involved

Try fid

Clone the repository, run the test programs, and file an issue for anything that surprises you. Early feedback shapes the language.

Join the discussion

Design debates about syntax, regions, effects, and capabilities happen in the open on GitHub. Bring your hardest use case.