// Package iskra is the port of the iskra .mx tree: coord arithmetic, the token // dictionary, the .meta store and the verbs built on them. package iskra import "git.smesh.lol/go-iskra/lattice" // Stage tags, high byte of a code key. const ( StageSRC uint8 = 0x01 StageAST uint8 = 0x02 StageIR uint8 = 0x03 StageASM uint8 = 0x04 StageBIN uint8 = 0x05 ) // StageName is the printed name of a stage. func StageName(s uint8) string { switch s { case StageSRC: return "SRC" case StageAST: return "AST" case StageIR: return "IR" case StageASM: return "ASM" case StageBIN: return "BIN" } return "?" } // NameKey is the key for a named entity at a stage: stage byte over the FNV-1a // hash of the name. func NameKey(stage uint8, name string) lattice.Key { return lattice.MakeCodeKey(stage, lattice.HashBytes([]byte(name))) } // SegmentKey is the key for segment content at a stage. func SegmentKey(stage uint8, content []byte) lattice.Key { return lattice.MakeCodeKey(stage, lattice.HashBytes(content)) }