TinyTalk v8.0 Official Language Specification & Standard Library Reference Open Interactive Arena →
TinyTalk Docs
GitHub Launch Arena →
Official Specification • v8.0.0

TinyTalk Language Guide

TinyTalk (.tnt) fuses the live-programming object heritage of Smalltalk-80 with Pythonic readability, zero-cost C register lowering, deterministic 0.000 ms lexical arena memory, and multi-target emission from 5.5 KB desktop binaries to quantum statevectors.

Installation & Setup

Install the official tinytalk-lang distribution via pip, or download a standalone native toolchain binary for Windows, Linux, or macOS:

TERMINAL • INSTALL VIA PYPI
pip install --upgrade tinytalk-lang

Verify that the compiler and 5-Stage Gatekeeper certification suite are available on your PATH:

TERMINAL • VERIFY TOOLCHAIN
$ tnt --version
TinyTalk v8.0.0 (x86_64-pc-windows-msvc, 0ms GC, Auto-TCO, WebGPU, Quantum)

$ tnt gatekeeper
[TinyTalk Gatekeeper] Running 5-Stage Zero-Defect Pre-Release Quality Pipeline...
  [PASS] Stage 1: stdlib_and_selfhost_syntax_mir_check
  [PASS] Stage 2: unit_test_suite_discovery
  [PASS] Stage 3: adversarial_fuzzer_torture
  [PASS] Stage 4: multi_target_emitter_matrix
  [PASS] Stage 5: packaging_and_manifest_check
[TinyTalk Gatekeeper] CERTIFICATION SUCCESS: All stages passed!

VS Code Extension & LSP

TinyTalk ships with a full Language Server Protocol (LSP) daemon providing real-time Hindley-Milner type hover, MIR register layout inspection, and Socratic Inquisitor code synthesis:

TERMINAL • INSTALL VSIX
code --install-extension dist/tinytalk-8.0.0.vsix

Hello TinyTalk (.tnt)

Save the following program as fib.tnt. TinyTalk uses clean indentation blocks and compiles recursive functions to tight register loops:

TINYTALK • fib.tnt
def fib(n: i64) -> i64:
    if n <= 1:
        return n
    return fib(n - 1) + fib(n - 2)

def main() -> i64:
    let ans: i64 = fib(30)
    print("Fibonacci(30) =", ans)
    return 0

Types, Unboxed Structs & Auto-TCO

Primitive scalar types (i64, f64, bool, str) and composite struct types are unboxed directly into CPU registers (RAX, RCX, XMM0–XMM15) with zero heap pointer indirection.

Self-recursive tail calls are automatically rewritten by the Middle Intermediate Representation (MIR) pass into zero-overhead hardware jumps, executing 5,000,000+ recursive frames in O(1) stack memory.

TINYTALK • unboxed_arena.tnt
struct Vec3:
    x: f64
    y: f64
    z: f64

def dot(a: Vec3, b: Vec3) -> f64:
    # Lowered to 3 SSE2/AVX mulsd + addsd instructions in XMM0-XMM5
    return (a.x * b.x) + (a.y * b.y) + (a.z * b.z)

CLI Command Reference

The unified tnt CLI drives JIT execution, multi-target cross-compilation, Smalltalk live images, and Gatekeeper verification:

Command Description
tnt run <file.tnt> Compiles and executes a .tnt file immediately via the native x86-64 JIT engine.
tnt build <file.tnt> --target [exe|wasm|elf|macho|c] Emits standalone 5.5 KB native executables, 1.7 KB WebAssembly modules, or ANSI C11 source.
tnt studio Launches the Smalltalk-80 Morphic Studio and Socratic Inquisitor synthesis engine.
tnt inspect <file.tnt> Displays inferred static types, MIR basic blocks, and lowered native assembly.
tnt bench Runs head-to-head microbenchmarks against CPython 3.14.
tnt gatekeeper Executes the 5-Stage Zero-Defect certification pipeline across all targets.

Universal Differentiable Physics

First-class reverse-mode automatic differentiation (DiffVar) and symplectic Hamiltonian integrators preserve phase-space volume and Noether conservation laws:

TINYTALK • autodiff.tnt
from diff_physics import DiffVar

def main() -> i64:
    let x = DiffVar(2.0)
    let y = DiffVar(3.0)
    let z = (x * x) + (x * y)
    z.backward()

    print("dz/dx =", x.grad)  # 2*x + y = 7.0
    print("dz/dy =", y.grad)  # x = 2.0
    return 0

Quantum Circuits & OpenQASM 3.0

Simulate exact complex statevectors, entangle Bell EPR pairs, and lower quantum circuits directly to OpenQASM 3.0:

TINYTALK • quantum_bell.tnt
from quantum import QuantumCircuit
from qasm import to_openqasm3

def main() -> i64:
    let qc = QuantumCircuit(2)
    qc.h(0)     # Hadamard gate on qubit 0: superposition
    qc.cx(0, 1) # CNOT gate entangles qubit 0 and 1
    print(to_openqasm3(qc))
    return 0

Neuromorphic Silicon & DNA Nanostructures

Compile biological Leaky Integrate-and-Fire (LIF) spiking neural networks to Intel Loihi 2 neuromorphic microcode, and synthesize Watson-Crick complementary DNA origami scaffold/staple strands:

TINYTALK • snn_loihi.tnt
from neuromorphic import LIFNeuron

def main() -> i64:
    let neuron = LIFNeuron(v_thresh=1.0, tau_m=20.0, v_rest=0.0)
    for step in range(10):
        let spiked = neuron.step(current=0.35)
        print("Step:", step, "Membrane Potential:", neuron.v, "Spiked:", spiked)
    return 0