Contributing
Thank you for considering a contribution. This page is the short version of what you need to know; the repository’s own docs hold the detail.
The two compilers
The compiler is written in Fid (compiler/*.fd, 72 modules, about 210K lines). The earlier compiler in Rust (src/*.rs) is frozen: it runs the test suite and builds stage 1 of the bootstrap, and gets no new features. It checks less than fid, and the language is what fid accepts: see the language reference.
| You want to… | Use |
|---|---|
| Write Fid programs, add tests, add stdlib modules | the self-hosted compiler (release/fid.exe) |
Build tools (ark, scribe, veil) | cargo build --release |
| Change the language or compiler internals | compiler/*.fd only |
Setting up
git clone https://github.com/pledgeandgrow/fid
cd fid
cargo build --release # builds fidesc, ark, scribe, veil
./target/release/fidesc test --compiler fid # every test program on all backends, compiled by fid./verify.sh runs the build and the tests and diffs the results against the checked-in baseline, so you can see exactly which tests a change affects. Run it before you start and after every change.
Good first contributions
- A test program. Add
tests/bootstrap/test_<feature>.fd, run./verify.sh --saveto update the baseline. Every test runs on the interpreter, the C backend, and the native emitter. A program the compiler must reject is namedtest_<feature>_fail.fdand starts with a// expect-error:line. - A standard library module or function.
stdlib/*.fdis plain Fid; mistakes surface as test failures, not silent miscompiles. Add a///doc comment andscribedocuments it. - Docs and error messages. Every docs page on this site has a “Report an issue” link at the bottom.
- A bug report with a minimal reproducer. Often more valuable than a patch.
Compiler changes
Some files can break every program silently when edited: the register allocator, the peephole optimiser, the object-file emitters, and the code generators. The repository’s AGENTS.md lists them with the risk level of each. For those:
- Run
./verify.shfirst to confirm a clean baseline. - Make the smallest possible change: one change, one commit, one verification run.
- If a test regresses, find the stage responsible with
dump-ir,dump-pirandcodegen --peephole. - Every bug you fix gets a regression test in the same change.
Never rewrite history, force-push, or discard someone else’s uncommitted work in a shared checkout; the repository guide is explicit about this.
Pull requests
- One topic per PR, with the test that proves it.
- Say which backends you ran. “Interpreter only” is a fine answer; it tells the reviewer what to check.
- Keep the docs truthful: if a change moves a feature from partial to working (or the reverse), update
docs/reference/features.mdin the same PR. Feature Status on this site mirrors that file.
The website
This site lives in its own repository and is a static Astro build. npm run dev starts it, npm run check lints and type-checks, npm run build must pass before a PR is merged. Docs pages are Markdown under src/pages/docs/ and are registered in src/data/docsNav.ts.
Conduct and licensing
All spaces run under the Code of Conduct. By contributing you agree that your contribution is licensed under the project’s licence as published in the repository.