Synced
Every line runs at the same time, one command per tick, and each line keeps one number.
ZippyMagician, 2020 · Turing complete: no · ●●○ moderate · esolangs.org
Tested with 5 known programs · Test method
Run it
The idea
ZippyMagician made Synced in 2020, out of boredom, the specification says. A program is a set of lines, and each line is an operator with a value of its own that starts at 0. On every tick all lines run their next command at once. A line that runs off its end starts again, from its first ^ if it has one.
Read the story
Lines work together only by reading each other's values, by line number. A line can only go back to its own start or first ^, so timing is everything. A space does nothing for one tick, and programs pad their lines with spaces so that a value is ready on the tick another line reads it. The program ends when every line has halted with |.
The machine
| Command | Does |
|---|---|
.x | Store x as the value |
:x | Print x and a line feed |
;x | Print the character with code x and a line feed |
+n -n *n /n %n | Combine the value with the value of line n |
~ | If the value is not 0, go back to the start or to the first ^ |
^ or a space | Do nothing for a tick |
| | Halt this line |
A parameter is a number, a "string", $ for the line's own value, % for the next number or letter of the input, or @ for the code of the next input character. Lines are numbered from 0, and every line reads the values as they were when the tick began.
Example
The truth machine stores the input and prints it, and ~ sends it back to ^ while the value is not 0.
The truth machine stores the input and prints it, and ~ sends it back to ^ while the value is not 0. On 1 it prints 1 forever.
The factorial runs four lines side by side. Line 0 holds n and counts it down by line 1, which holds 1 and halts after two ticks. Line 3 multiplies itself by line 0 once a round. Line 2 works out line 3 times line 0 each round, and once that is 0 it prints line 3 and halts. The spaces make every round five ticks long, so the three loops stay in step.
The Fibonacci program is two lines that add each other's values and print them, and it never halts.
Further
See also
Cell-based
Write your own in Run Convert a program from Synced
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: synced.
Command line
shib run synced -e '.%^:$~|' --input '0'shib manual syncedSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/synced.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org