README: rewritten around what runs (Linux software, Xorg, apk, Linux's drivers), the honest gaps, measured numbers. plan/: 1.0.md is the finish line, where each clause of the acceptance test stands, and the register (one failing clause: a root that survives a reboot); built plans (foundations, hybrid, alpine, xorg) and the decided-against one (wayland) are gone, their content lives in architecture/; roadmap.md is only what is still open. guides: building/layout/testing/adding-a-driver (Linux code may be used). history: four entries (ls -lR, TLB shootdowns, MDIO 0x02460246, netlink MSG_TRUNC). Website: cards, stack, download page, docs index. Code comments that pointed at deleted plan docs point at the architecture docs. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EVRhxi9zpdW2uDUN4FVcao
4.4 KiB
Finch, for SchOS's own programs
Two things, and only one of them is later.
- Bringing Finch into SchOS (below) is later — behind 1.0.md's freeze like everything else here that is not named there.
- Finishing Finch itself, and making it fully self-hosting, is work on the Finch repository and does not touch this tree. It can proceed now; see the gap.
Finch is the author's own language: https://github.com/Nexoniarz/Finch (mirrored to
pandor.pl/git/nexoniarz/Finch, which is read-only). The plan is to write SchOS's own
applications and tools in it, in place of C, and so leave behind what C does
badly: silent narrowing, signed/unsigned mixing, undefined behaviour on an
out-of-range index, a forgotten free.
What it is today (version 2.4.0)
Measured from the repository, not from its README alone:
- LLVM front end, C-like syntax, no semicolons, no headers, no preprocessor.
It compiles through LLVM's
-O2pipeline to native code; there is no garbage collector. - Values, not references: lists, text and structs copy on assignment and are freed at the end of their block. Out-of-range indexes, division by zero and null pointers stop with a runtime error rather than undefined behaviour.
- Errors as values (
int(s) or 0,try read_file(p)), maps, methods, modules. - C interop through libclang:
import "foo.h"pluslink "foo"calls any C library, structs by value and callbacks included. That is the way in to everything SchOS already has — musl, the/dev/*interfaces, Alpine's libraries. - Targets: Linux, macOS, Windows, on x86-64 and ARM64 (
src/platform.fch; the System V, AAPCS64 and Microsoft x64 ABIs are insrc/gen.fch). ARM64 and Windows programs are run under qemu and Wine in the tests; macOS is IR-checked. - Language: enums,
match, generics, errors as values, maps, methods,defer, and a standard library in Finch (json,path,time,proc). - Tooling: a language server (
finch lsp, written in Finch), VS Code and 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
- A
schostarget.finchpicks a triple, a C compiler and a linker per target. SchOS runs unmodified Alpine binaries and Alpine's musl (see packages), so the first target is the existingx86_64-unknown-linux-musl, and a Finch program built on the host should run on SchOS before anything in Finch is made SchOS-specific. Test that before writing a line of target code. - 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.
- The Finch-written compiler on SchOS. It emits LLVM IR as text and needs
only
clangand libclang, no LLVM C++ libraries, so it is the compiler that would ship in the image. It needs a seed made for the SchOS target. - Bindings for SchOS's own interfaces (
/dev/pci,/dev/netdev, schinit's job protocol, the framebuffer) — generated by the C importer from the headers ininclude/uapi/, so they are not hand-written and cannot drift from the kernel.
Where self-hosting stands
The compiler is written in Finch and nothing else, and it is main of github.com/Nexoniarz/Finch
(before-bootstrap there is the all-C++ compiler, kept as the backup). bootstrap/build.sh builds it from a seed (its
own IR) and then from itself, and checks the two make identical IR. 110 tests pass, also under valgrind with no leaks.
Seeds: Linux x86-64 and ARM64; Windows x86-64 (runs under Wine, compiles itself and passes every test program); macOS
ARM64 and x86-64 (made with the 11.3 SDK, checked as IR only — nobody has run them on a Mac). The language has enums
(also with values inside), match, generics and a standard library; the compiler carries its runtime and std inside
itself.
Rules
- Inference, not an instruction: the kernel stays in C. Finch is for applications and tools; the user said "our apps or stuff like that".
- No new capability starts until the register of unfinished work is empty; the SchOS half of this document is a plan, not an exception to that.