Three != Two: A Complete Balanced Ternary Software Stack. maniTC and thatteOS — Language, Dual-Target Compiler, and Microkernel
Abstract
A complete software stack built for balanced ternary from first principles rather than ported to it: ManiT, a statically typed systems language with trit-native primitive types; maniTC, a compiler lowering through a balanced-ternary SSA intermediate representation to two independent backends (LLVM IR for binary hardware today, and T3ISA, a 27-trit instruction set with assembler and reference emulator); and thatteOS, a microkernel in which privilege is a single trit and permission checking is the ternary minimum function rather than a comparison routine. Everything builds and runs today on ordinary binary hardware. Evaluation is by differential testing across the two backends: 18 of 20 shipped programs are byte-identical, with the two exceptions characterised exactly. T3ISA emits 1.6–2.2× fewer assembly lines than the LLVM backend from identical source, and 7.2–8.7% of executed instructions are operations with no binary equivalent. The paper also reports two silent-wrong-answer defects that the cross-backend comparison exposed and that a 313-test suite had been green over — in one case because a golden file recorded the wrong answer as its expected output. No performance claim is made for ternary hardware; none exists to measure. This is the software half of a twelve-patent photonic-ternary computing architecture, and it is the half being given away.
// Source
Authors: Manish Thatte