ABC: the foundation C dialect

ABC is Beagle's foundation C library, the dialect every dog is written in. The goal is fast, allocation-light systems C with no runtime and no garbage collector: data lives in flat, contiguous buffers, and concurrency is cheap message-passing processes, not shared threads. The method is a few idioms — slices and buffers over pointer-plus-length pairs, a per-thread scratch arena over malloc, ragel grammars over hand-rolled parsing, and one error-and-resource discipline in the PRO.h macros.

Memory model

ABC moves data by consuming slices and filling buffers, never by tracking a pointer beside a length. A slice is a pair of pointers; a buffer owns a range; an arena hands out scratch along the call stack.

Errors and control flow

Every fallible function returns an ok64 and threads it through the PRO.h macros, keeping error handling and resource ownership orthogonal. Resources are acquired at the top of the chain and released by their owner.

Naming

Functions read MOD typ8 VerbStuff: a module prefix, the operand type, the verb, and a combinatorial suffix. Fixed-layout record types end in their bit width.

No manual parsing

ABC never hand-scans bytes to recover structure. Lexing and parsing go through ragel state machines, generated to .rl.c and committed beside their source; a hand-rolled byte loop is a defect, not a shortcut.

Paths and hashes

Two record families recur across the dogs and both avoid the char-array-plus-length antipattern: NUL-terminated path buffers, and fixed-width content hashes.