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 (18 modules) are the ground floor.

Corrected 1 September 2026. This paragraph read "(12 modules)" from the initial public release until now. Twelve was accurate on the day it was written — SemanticAnalyzer::STDLIB_MODULES held exactly twelve then — and six modules (t27f, crypto, bridge, tritfs, test, trit) were added afterwards without the sentence being reopened. The count is now taken from that registry rather than from prose, and pinned by tests/audit_regression_tests.rs::documented_stdlib_module_counts_match_the_registry.

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

21 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages