We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
Tact
| Paradigm(s) | imperative, stack-based |
|---|---|
| Designed by | User:Las-r |
| Appeared in | 2026 |
| Computational class | Turing complete |
| Reference implementation | GitHub |
| File extension(s) | .tc |
Tact is a stack-based esoteric programming language created by Nayif Ehan in 2026.
Concepts
Tact programs consist of a single string of characters executed sequentially from left to right. The program halts automatically when the instruction pointer moves past the end of the source string.
Stack
Tact operates on a single standard stack of integers. Any attempt to pop or inspect an element from an empty stack results in an immediate interpreter crash due to a lack of bounds checking.
Pointer
The instruction pointer tracks the index of the character currently being executed, starting at index 0. Control flow is handled by dynamically setting or incrementing this pointer based on top-of-stack values.
Syntax
| Symbol | Name | Action |
|---|---|---|
| 0–9 | Push digit | Push that digit onto the stack |
| * | Times ten | Pop a, push a × 10 (used to build multi-digit numbers) |
| + | Add | Pop a, b, push a + b |
| - | Subtract | Pop a, b, push b - a (second-popped minus first-popped) |
| d | Duplicate | Push a copy of the top element |
| x | Discard | Pop and discard the top element |
| s | Swap | Swap the top two elements |
| o | Over | Push a copy of the second-from-top element |
| r | Rotate | Rotates the top 3 elements, i.e. brings the third element to the top |
| j | Jump | Pop n, set instruction pointer to index n |
| > | Skip-if-positive | Pop n; if n > 0 continue normally, else skip the next instruction |
| < | Skip-if-negative | Pop n; if n < 0 continue normally, else skip the next instruction |
| i | Input | Read an integer from user input and push it |
| p | Print the top of stack without popping |
Examples
Note: An in-place variation works directly with the numbers at the top of the stack, acting as a sort of operation itself.
Countdown
ipd1-s1s>j
Nth Triangular Number
0iso+s1-d2s>jxxp
Multiplication
0iisro+sr1-d3s>jxxxp
In-place variation: 0rrsro+sr1-d3s>jxxx
Factorial
1id1-2*s>jxxp9*j0x0xd1-rr0rr0xsro+sr1-d3*s>jxxxs2j