Ternary

From Esolang
Jump to navigation Jump to search

Ternary is an esoteric programming language created by zerosum0x0 in 2015. It consists only of the ASCII characters 0, 1, and 2. It is a member of the TrivialBrainfuckSubstitution family of programming languages.

Commands

Brainfuck Ternary Description
> 01 Move the pointer to the right
< 00 Move the pointer to the left
+ 11 Increment the memory cell under the pointer
- 10 Decrement the memory cell under the pointer
. 20 Output the character signified by the cell at the pointer
, 21 Input a character and store it in the cell at the pointer
[ 02 Jump past the matching 12 if the cell under the pointer is 0
] 12 Jump back to the matching 02

Examples

Hello, world! program

11111111111111110201111111110201111101111111011111110111000000001012011101110110010111020012
00101201012001101010201111111111111120201111112001012000102000201111112010101010101020101010
1010101010200101112001111120

Cat program

The following demonstrates an infinitely repeating cat program which terminates if encountering the null character.

2102202112

External resources