esolang

Tonoco

Twenty-six boxes that each do one thing. A program wires them together and drops numbers in.

David.werecat, 2013 · Turing complete: unknown · ●●○ moderate · esolangs.org

Tested with 6 known programs · Test method

Run it

Expected: Hello, world!

The idea

David.werecat made Tonoco in 2013. A program has three instructions. It can wire the output of one box to another, remove that wire, or send a number to a box. Everything else happens in the boxes, which are named A to Z. A adds, H prints a number, I skips the next instruction on a 0, Y and Z switch execution off and on again.

Read the story

When a box gives a value, the value goes to every box it is wired to in alphabetical order, and each of those finishes its own chain before the next one gets it. The specification says such a network could run on real computers instead of the virtual one in its interpreter.

The machine

InstructionDoes
CxyWire the output of box x to box y
DxyRemove that wire
SxnSend the integer n to box x
BoxDoes
A S M D POn each two inputs give the first + - * / % the second
B R X NAnd, or and xor of two inputs, not of one
V W-1 if the first is less or greater than the second, else 0
C KRead a character code, or a line as a number
H QPrint a number or a character
T GStore the second input at the address in the first; read an address
U OPush; pop
EGive the input before this one
ISkip the next instruction when the input is 0
Y ZSwitch execution off one level deeper; switch it on again at that level
L JMake a label at this instruction; jump to one
FEnd

Values are 32-bit integers. While execution is off or skipped, a box still makes labels and Y and Z still count levels, but nothing else happens and C and D instructions are ignored.

Example

The cat wires C to N and Q, and N to I.
Expected: cat

The cat wires C to N and Q, and N to I. C reads a character and its code goes to N first. N inverts it, which gives 0 only for -1, the end of the input. Then I skips the rest of the chain, so Q never prints the -1, and it skips the jump back, so the program ends.

The Fibonacci keeps the last number on the stack and the next one in memory cell 0. W compares each new sum with 10000, and once it is bigger I no longer skips F.

Expected: 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765

The specification also has a greeter that keeps a name in memory and a Deadfish interpreter that takes one command a line.

Patterns it teaches

  • Stack machines: U and O give the network a stack, and the Fibonacci keeps its last number there.

Further

Object-oriented paradigm

Stack-based

Write your own in Run Convert a program from Tonoco

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: tonoco.

Command line

shib run tonoco -e 'CCNCCQCNISL0SC0SJ0' --input 'cat'
shib manual tonoco

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/tonoco.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org