GizStack
View .mdOpen in ChatGPTOpen in Claude

gizlang:runtime

The runtime written in Gizlang: what the compiler lowers a construct to (the compiler appends this module wherever string( occurs). string(x) of bytes checks them with utf8Valid, which bytes.isUtf8 (gizlang:text) shares.

gizlang
import * as Runtime from "gizlang:runtime";

Functions

blockAt

gizlang
function blockAt(data: bytes, i: i64, end: i64): u8x32

32 bytes of data from i, zeros past end (never read past it).

Effects: fail.

utf8Valid

gizlang
function utf8Valid(self: bytes, start: i64, end: i64): bool

Whether bytes start..end of self are valid UTF-8 (RFC 3629), 32 bytes a step: three nibble lookups classify each byte against the one before (J. Keiser and D. Lemire, "Validating UTF-8 In Less Than One Instruction Per Byte", 2021); an ASCII block only carries the check of the block before.

Effects: fail.