Skip to content

maniTC — the ManiT compiler

CI License: AGPL v3 DOI

Companion paper: Three != Two: A Complete Balanced Ternary Software Stack (Zenodo, CC BY 4.0).

ManiT is a systems programming language in which balanced ternary is the native number system: integers are signed by construction, logic is three-valued (True / Unknown / False), and the fundamental control-flow construct is a three-way branch. maniTC is its compiler — written in Rust, with two backends:

  • LLVM IR — compile and run ManiT programs natively on your machine today
  • T3ISA — a balanced ternary instruction set, with an assembler and a cycle-accurate emulator included, targeting photonic-ternary hardware (The THATTE Device)

This is not a binary language with ternary bolted on. t27 words, trytes and trits, Kleene three-valued logic, tif three-way branching, balanced ternary floating point (T27F), and a ternary-native standard library (12 modules) are the ground floor.

Quick start

New here? Read GETTING_STARTED.md — the full handbook from install to booting thatteOS.

cargo build --release

# compile to T3ISA and run on the cycle-accurate ternary emulator
./target/release/manitc compile --target t3 examples/ternary_demo.mt -o demo.t3b
./target/release/manitc run-t3 demo.t3b

# native execution via the LLVM backend (needs clang):
./target/release/manitc compile examples/hello.mt -o hello.ll
clang-19 -O2 -c runtime/manit_runtime.c -o manit_runtime.o
clang-19 hello.ll manit_runtime.o -o hello -lm && ./hello

# or compare both backends on one program
./target/release/manitc bench examples/fibonacci.mt

Seventeen example programs live in examples/ — from fibonacci.mt to a ternary neural network. Start with GETTING_STARTED.md, then the language reference, the stdlib reference, and the T3ISA reference.

The companion repository thatteos is a microkernel operating system written entirely in ManiT.

License

  • AGPL-3.0 (LICENSE) with the ManiT Runtime Library Exception: programs you write in ManiT and compile with maniTC are yours, under any license — the copyleft covers only the compiler, runtime, and stdlib themselves.
  • Commercial licenses for proprietary derivatives of the compiler/runtime are available: manish@manitlab.org

Contributions require the one-line CLA — see CONTRIBUTING.md.

Patents

The photonic-ternary hardware this language ultimately targets is covered by twelve patent applications filed with the Indian Patent Office (2026), sole inventor Manish Jagdish Thatte — see NOTICE. The AGPL's patent grant (§11) applies to this software as released; hardware implementations require a separate license.

Independent software implementations of T3ISA written from the published specification (docs/t3isa-reference.md) are welcome and encouraged — see NOTICE for the explicit permission and attribution request. Versioned spec releases are tagged t3isa-spec-vX.Y.


Authored by Manish Jagdish Thatte · manish@manitlab.org · manitlab.org

© Manish Jagdish Thatte, 2026

About

Compiler for ManiT, a systems language whose native number system is balanced ternary (−1, 0, +1). Two backends: LLVM for native execution today, and T3ISA — a ternary instruction set with assembler and cycle-accurate emulator included.

Topics

Resources

Code of conduct

Contributing

Stars

20 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages