Tier 1
Environment
VM Status
Checking…
Endpoint: ternlang-api.fly.dev
Node ID: bet-node-013
Plan & Quota
Tier 1 — Free
Monthly calls
Enter API key to see quota
Ternary Playground
Quickly evaluate trit expressions or convert decimal to ternary.
>
Work
Quick Actions
Analytics
Session Stats
0
Runs
0
Ok
0
Err
Recent Activity
No runs yet this session
Stdlib Coverage
core/12 modules
math/8 modules
agents/15 modules
safety/5 modules
ml/bitnetv1.58b
Key
No key — anonymous access
Tier 1
Plan Features
Endpoint: https://ternlang.com
GET /health VM health check
POST /api/run Execute .tern code
GET /api/usage Key quota
// Click Try to test an endpoint
Builtins
truth()→ trit(+1)Affirm signal
hold()→ trit(0)Neutral / pending
conflict()→ trit(-1)Reject signal
consensus(a,b)→ tritTernary AND merge
print(v)Print to output
println(v)Print + newline
Types
trit-1 / 0 / 1Balanced ternary value
inti64Integer
floatf64Floating point
trittensorN×MTrit tensor (Tier 2+)
VM Error Codes
BET-001StackUnderflowMissing return push
BET-007TypeMismatchWrong type for op
BET-010DivByZeroInteger divide by zero
BET-013OutOfBoundsRegister / tensor OOB
Drag agents from the library or click + to create
Connect agents by dragging from the right port ● to the left port ● of another
Execution Inspector
Node Properties
Select a node to configure
API Connection
Endpoint URL
API Key
Set new key
Save key locally
Stored in localStorage — never sent anywhere except the API endpoint
Editor
Font size
Minimap
Word wrap
Theme
About
TernStudio v0.3.0  ·  Ternary Intelligence Stack
Runtime: BET VM (27 registers · balanced ternary)
License: LGPL-3.0-or-later
ternlang.com  ·  GitHub

TernWiki

Technical Reference for Balanced Ternary Intelligence

Examples Quickstart Browse Stdlib GitHub
Language Fundamentals

Syntax Guide

Functions
fn add(a: int, b: int) -> int {
  return a + b;
}
Control Flow
match signal {
  affirm => { println("YES"); }
  tend   => { println("HOLD"); }
  reject => { println("NO"); }
}
Agents
agent Sensor {
  handle(s: trit) {
    spawn Consensus(s);
  }
}
Logical Operations

Truth Tables

Input A Input B Consensus
+1 (Affirm) +1 (Affirm) +1
+1 (Affirm) 0 (Tend) 0
+1 (Affirm) -1 (Reject) -1
0 (Tend) 0 (Tend) 0
0 (Tend) -1 (Reject) -1
-1 (Reject) -1 (Reject) -1
Did you know?
The Consensus operator is the ternary equivalent of a logical AND. It resolves to the minimum value of its inputs: consensus(A, B) = min(A, B) where +1 > 0 > -1.
Execution Tracer
Step-through debugging and register monitoring.
TernPkg Registry
Discover and manage ternary standard library modules.