kTVM: A Packed-Wire Execution Model and Compiler for K
K: the programming language defines computation as first-order partial functions (relations) over finite, rooted, edge-labeled trees paired with a self-delimiting binary wire format (k-wire). This sequel presents a self-contained description of kTVM (the K Transducer Virtual Machine), a packed-wire execution model and multi-target compiler that evaluates K relations on packed k-wire payloads without materializing pointer-linked heap trees. We formalize the closed schema algebra, wire equivalence, and prefix derivatives. The Dual-Schema Suffix Invariant specifies how single-producer, single-consumer BitDeque channels preserve their schema obligations under splice. We define the iterative pull semantics of K's combinators, including barriers for strict partiality and scoped replay for ordered choice. We then describe direct specialization of KIR-P and boundary specialization of kTVM-P templates, the two-tier network/kernel optimization pipeline with Minimum Weight-to-Time Ratio (MWTR) multi-bit lookup tables, the JavaScript interpreter and code generation for WebAssembly and C/LLVM, and the principal qualitative trade-offs observed against K's heap-allocated register machine (kVM).
Authors
- Wojciech Frączak
Institutions
- Université du Québec en Outaouais (CA)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-29
- DOI
- https://doi.org/10.5281/zenodo.24653604
- Primary Topic
- Logic, programming, and type systems
- Type
- preprint