docs: Finch is written in Finch now
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015f73FesGZGYPkmDvUcj6QX
This commit is contained in:
parent
d7ad3d09f7
commit
5843503033
1 changed files with 21 additions and 32 deletions
|
|
@ -30,13 +30,16 @@ Measured from the repository, not from its README alone:
|
||||||
library, structs by value and callbacks included. That is the way in to
|
library, structs by value and callbacks included. That is the way in to
|
||||||
everything SchOS already has — musl, the `/dev/*` interfaces, Alpine's
|
everything SchOS already has — musl, the `/dev/*` interfaces, Alpine's
|
||||||
libraries.
|
libraries.
|
||||||
- **Targets:** Linux, macOS, Windows, on x86-64 and ARM64 (`src/target.cpp`;
|
- **Targets:** Linux, macOS, Windows, on x86-64 and ARM64 (`src/platform.fch`;
|
||||||
the System V, AAPCS64 and Microsoft x64 ABIs are in `src/abi.cpp`).
|
the System V, AAPCS64 and Microsoft x64 ABIs are in `src/gen.fch`). ARM64 and
|
||||||
- **Tooling:** a language server (`finch lsp`), VS Code and Kate support, 74
|
Windows programs are run under qemu and Wine in the tests; macOS is IR-checked.
|
||||||
tests.
|
- **Language:** enums, `match`, generics, errors as values, maps, methods,
|
||||||
- **Self-hosting:** `boot/` is a Finch compiler written in Finch (about 3,100
|
`defer`, and a standard library in Finch (`json`, `path`, `time`, `proc`).
|
||||||
lines, against about 5,900 for the C++ one in `src/`, language server included) that builds itself to a
|
- **Tooling:** a language server (`finch lsp`, written in Finch), VS Code and
|
||||||
byte-identical result — `tests/boot.sh`.
|
Kate support, 107 tests.
|
||||||
|
- **Written in itself:** the whole compiler is Finch (about 8,500 lines in
|
||||||
|
`src/`, no C++) and builds itself from a committed seed to a byte-identical
|
||||||
|
result — `bootstrap/build.sh`.
|
||||||
|
|
||||||
## What SchOS would need to do
|
## What SchOS would need to do
|
||||||
|
|
||||||
|
|
@ -48,10 +51,9 @@ Measured from the repository, not from its README alone:
|
||||||
before writing a line of target code.
|
before writing a line of target code.
|
||||||
2. **The compiler on SchOS.** Needs LLVM 21 and libclang, both of which Alpine
|
2. **The compiler on SchOS.** Needs LLVM 21 and libclang, both of which Alpine
|
||||||
packages. That is a question of apk and memory, not of SchOS.
|
packages. That is a question of apk and memory, not of SchOS.
|
||||||
3. **`boot/` as the SchOS-hosted compiler.** The C++ compiler needs LLVM's C++
|
3. **The Finch-written compiler on SchOS.** It emits LLVM IR as text and needs
|
||||||
libraries; the one in `boot/` is the candidate for being the compiler that
|
only `clang` and libclang, no LLVM C++ libraries, so it is the compiler that
|
||||||
ships in the image, once it emits through LLVM's C API or a smaller
|
would ship in the image. It needs a seed made for the SchOS target.
|
||||||
back end.
|
|
||||||
4. **Bindings** for SchOS's own interfaces (`/dev/pci`, `/dev/netdev`,
|
4. **Bindings** for SchOS's own interfaces (`/dev/pci`, `/dev/netdev`,
|
||||||
schinit's job protocol, the framebuffer) — generated by the C importer from
|
schinit's job protocol, the framebuffer) — generated by the C importer from
|
||||||
the headers in `include/uapi/`, so they are not hand-written and cannot
|
the headers in `include/uapi/`, so they are not hand-written and cannot
|
||||||
|
|
@ -59,30 +61,17 @@ Measured from the repository, not from its README alone:
|
||||||
|
|
||||||
## Where self-hosting stands
|
## Where self-hosting stands
|
||||||
|
|
||||||
The Finch compiler written in Finch (`boot/`) now **builds itself**: stage 2 and
|
The compiler is written in Finch and nothing else. `bootstrap/build.sh` builds it
|
||||||
stage 3 are byte-identical (58,660 lines of LLVM IR), and it passes all 22 of
|
from the seed (its own IR, Linux x86-64 and ARM64) and then from itself, and
|
||||||
the repository's run tests (the C++ one passes 77/77). The work is on the
|
checks the two make identical IR. It passes the 107 tests: programs, refusals,
|
||||||
|
`-g` builds, a shared library and the language server. The work is on the
|
||||||
`finish-finch` branch of `github.com/Nexoniarz/Finch`; `before-bootstrap` there
|
`finish-finch` branch of `github.com/Nexoniarz/Finch`; `before-bootstrap` there
|
||||||
is the all-C++ compiler, kept as the backup. `main` is untouched.
|
is the all-C++ compiler, kept as the backup. `main` is untouched.
|
||||||
|
|
||||||
What the self-hosted compiler has: sized numbers, methods, `defer`, errors as
|
Left: the compiler does not run on macOS or Windows yet (it needs a seed made
|
||||||
values, maps, `for k, v in`, C import through libclang (written in Finch, in
|
with those systems' headers; programs for them are built from Linux with
|
||||||
`boot/cimport.fch`), C structs by value and `addr(fn)` callbacks (System V
|
`--target`), and `main` is switched to this branch only when the author says so,
|
||||||
x86-64), `run`, `build`, `ir`, `version`, `-O0`, `-l`, `-I`.
|
after merging their local `embed` work.
|
||||||
|
|
||||||
What it does **not** have yet, and the C++ compiler does:
|
|
||||||
|
|
||||||
| | |
|
|
||||||
|---|---|
|
|
||||||
| `-g` debug info | text IR needs the DWARF metadata written by hand |
|
|
||||||
| `--target` (Windows, ARM64, macOS) | their struct-passing rules (`abi.cpp`) and linkers |
|
|
||||||
| `lsp`, the editor language server | `lsp.cpp`, 580 lines |
|
|
||||||
| `export fn`, `build --shared` | on the author's local `embed` branch |
|
|
||||||
|
|
||||||
**`main` becomes the Finch-written compiler when those are in**, so that
|
|
||||||
nothing a user does today stops working; until then it is the seed that builds
|
|
||||||
the first stage. The new language features (enums, `match`, generics, a
|
|
||||||
standard library) come before that switch, as simple as the rest of the language.
|
|
||||||
|
|
||||||
## Rules
|
## Rules
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue