FROM HERE TO THERE
One instruction, FROM x TO y. Where y is decides what happens to x.
PythonshellDebugwindow, 2020 · Turing complete: unknown · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
PythonshellDebugwindow made FROM HERE TO THERE in 2020. Every line of a program is the same instruction, FROM x TO y. Sending a value to OUT prints it, sending a number to LINE jumps there, and sending it to a name sets a variable.
Read the story
Sums are written backwards. FROM n TO n - 1 adds 1 to n, n + 1 takes 1 away, n / 4 multiplies by 4 and n * 4 divides. The specification says standalone math is illegal, so every sum lands in a variable.
Sending a value to a literal is the strangest move. FROM "0" TO 6 finds every variable that holds the string "0" and changes it to 6. The truth machine uses it to turn its input into a line number.
The machine
| y | Does with x |
|---|---|
OUT | Print x and a line feed |
LINE | Jump to line x, counted from 0 |
| a name | Set that variable to x |
n - k n + k | Set n to x + k or x - k |
n / k n * k | Set n to x times k, or x divided by k and rounded down |
a number or "string" | Every variable that equals x becomes it |
<file> | Write x to the file |
ERR | Print x to the error stream |
x is a number, a "string", a variable, a <file>, IN for a line of input or LINE for the number of this line. Lines end at a line feed or a semicolon. In this implementation files live in memory for one run, and reading past the end of the input stops the program with an error, as it does in the reference Python interpreter.
Example
The variable operations set myVar to 7 and then 19, add 1 and divide by 4.
The variable operations set myVar to 7 and then 19, add 1 and divide by 4.
The truth machine. FROM "0" TO 6 and FROM "1" TO 4 turn the input into the line to jump to. Line 6 prints 0 once; line 4 prints 1, and line 5 jumps back to it forever.
The interpreter's sums are Python's, so /, which multiplies, also repeats a string.
Patterns it teaches
- One instruction: every line is FROM x TO y, and the kind of y picks the operation.
See also
OISC
Write your own in Run Convert a program from FROM HERE TO THERE
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: from-here-to-there.
Command line
shib run from-here-to-there -e 'FROM "Hello, World!" TO OUT'shib manual from-here-to-thereSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/from-here-to-there.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org