Finch/boot
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nexoniarz 609ceffe58 enums and match (in the compiler written in Finch)
enum Color { Red, Green, Blue }   enum Status { Ok = 200, NotFound = 404 }

Color.Red, Color(n) (checked), int(c), == and != only, printed by name, usable as
map keys and struct fields, with methods (fn Color.next()).

match value { Red, Green -> ... Blue -> ... else -> ... } as a statement, or as an
expression that gives a value. Works on enums, whole numbers, chars, text and bools;
a match on an enum has to handle every variant or end with else, and says which are
missing. A bare variant name (Red) is enough inside a match on an enum.

Only the self-hosted compiler has them; tests/new holds their tests, tests/run stays what
the C++ compiler also runs. boot.sh: 31 passed.
2026-10-25 20:49:04 +01:00
..
ast.fch enums and match (in the compiler written in Finch) 2026-10-25 20:49:04 +01:00
cimport.fch boot: C import (import "x.h", link, C functions, constants, globals, .ptr, ptr(x)) 2026-10-25 19:44:58 +01:00
gen.fch enums and match (in the compiler written in Finch) 2026-10-25 20:49:04 +01:00
lexer.fch enums and match (in the compiler written in Finch) 2026-10-25 20:49:04 +01:00
main.fch boot: finch run, version, -O0, -l, -I; clear errors for -g and --target 2026-10-25 19:49:04 +01:00
parser.fch enums and match (in the compiler written in Finch) 2026-10-25 20:49:04 +01:00