Repository navigation
Finch 2.0.0
Finch 2.0 turns the small core of 1.0 into a complete small language, and a compiler that can build itself.
New in the language
- Structs with default values:
Point(1, 2),Player(name: "Ola"), nested structs,printshows them - Arrays
[]Twith bounds checks:push pop insert remove clear resize find contains join slice reverse sort,for x in list - Text that knows its length:
+,.len,s[i],sub find contains starts_with ends_with split trim upper lower replace repeat,str(x),int(s),float(s) - Memory without
free: arrays, strings and structs are values; assignment copies, the end of a block frees, results move, parameters are lent. Every test runs clean under valgrind defer, andnew(...)/free(...)for your own heap structures (lists, trees)- Modules:
import shapes→shapes.area(b),shapes.Box input(),read_file,write_file,file_exists,shell,exit,fn main([]str args)
C interop
- C structs by value with the System V x86-64 calling convention (raylib's
Vector2/Color, libclang'sCXCursor, …), C struct fields and fixed arrays addr(fn)gives C a callbacklink "mycode.c"compiles and links your own C files
Tools
-g: DWARF debug info for gdb/lldb (breakpoints, locals, struct fields)finch run file.fn args...passes arguments to the program
Bootstrap
boot/ is a Finch compiler written in Finch (about 3,000 lines). Built by the C++ compiler, it compiles itself, and stage 2 and stage 3 produce byte-identical LLVM IR. tests/boot.sh checks it.
Branding
A logo (light and dark), an icon and a social preview: see assets/.
Docs
The guides for beginners, technicians and engineers, in English and Polish, now cover everything above. The engineers' guide includes the ownership model and the ABI work, with real compiler output.
Breaking changes from 1.0
strnow carries its length and is never null:s == nullis an error (uses.len == 0). To pass text to avoid*C parameter, uses.ptr.char *inside C structs and globals isptr[char](read it withstr(p)); in function parameters and results it is stillstr.