Datums
256 bytes and an assignment. Jumps are writes to the bytes that hold the instruction counter.
Dylan Turner, 2020 · Turing complete: with unbounded memory · ●●○ moderate · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
Dylan Turner made Datums in 2020 and calls it data oriented. A program can really only do three things. It can set data, pause the setting of data, and resume it. There is no jump and no condition. Instead the machine keeps its own instruction counter in memory, so writing to it is a jump.
Read the story
Bytes 0 to 9 are special. Reading byte 0 reads input, writing byte 1 prints it, and bytes 2 to 9 hold the counter as one long. After each instruction the counter goes up by 1, so a write of 2 to the counter goes on at instruction 3.
The only way to decide anything is the pause, which is a little like INTERCAL. ! n skips every assignment until > has been called n times. Loops are built by pausing for a number the program has just computed, then calling > a fixed number of times. While the count has not run out, the assignment that would end the program is skipped.
The machine
| Instruction | Does |
|---|---|
# name size | Make a type of that many bytes; char 1, short 2, int 4, long 8 are built in |
(n : type) = data; | Write data to the bytes from n on; also += -= *= /= %= |
! n ! (n : type) | Skip assignments until > has run that many times |
> | Count one resume |
Data is a list of decimal bytes, read as one big-endian number, or (n : type), the value at n, or [n : type], the value at the address that n holds. Values are unsigned and wrap at their size.
Example
The Hello World stores the message backwards at bytes 10 to 23 and the address of its last letter at byte 24.
The Hello World stores the message backwards at bytes 10 to 23 and the address of its last letter at byte 24. Each round prints the byte that byte 24 points to and lowers byte 24 by 1. The pause is for byte 24's value, and 9 resumes come before the jump to the end. That jump is skipped until byte 24 has come down to 9, after the line feed.
The truth machine prints its input and takes 48 from it. On 0 nothing is paused, and the jump to the end runs. On 1 that jump is skipped and the program loops, printing 1 forever.
A count from A. The pause is 68 less the next letter, so the jump to the end is skipped until the letter reaches D.
Further
See also
Also in Turing tarpits
Write your own in Run Convert a program from Datums
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: datums.
Command line
shib run datums -e '(10 : char) = (0 : char);
(1 : char) = (10 : char);
(10 : char) -= 48;
!(10 : char)
(2 : long) = 0 0 0 0 0 0 0 8;
>
(10 : char) += 48;
(2 : long) = 0 0 0 0 0 0 0 0;' --input '0'shib manual datumsSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/datums.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org