Dat

From Esolang
Jump to navigation Jump to search

Made in scratch, visit here. by User:Hajunsheng.

structure

"data|code"

Execution begins at the first character in the code section, immediately after the first |

commands

"+" goes to next cell in data

"-" goes to last cell in data

"*x" will set the current cell to x

"#" halts the program correctly

"p" prints the current cell

"i" gets one character of user input(or first character) and stores it

">" sets loop start position

"<x" will go to loop start position if x is equal to current cell

Command Effect
+ move right on the tape
- move left on the tape
*c set the currently selected cell to c
# halt the program
p print the current cell
i input a character into the current cell
> set the loop start position
<c if the current cell contains c then jump to the start position

The head starts at the first character in the data segment. In addition to the input data, "DEBUG_UNTITLED_NOTHING" is appended to the end before execution.

Only one start position exists, the > command will overwrite it whenever encountered. The jump point starts at 0, meaning a jump without assignment will jump into the data and execute it as code.

The interpreter will output "SME ERROR" if the program is not in "data|code" format or if the program is not halted with #.

Computational class

An interesting subset exists. If we separate the data and code, such that the initial data assigns the start of an infinite tape, remove the IO commands, as well as the loop start command. Instead, the jump command would jump to the start. This is reminiscent of Brainpocalypse but with bounded, non-incrementing cells. It is unknown if such a subset is Turing complete, but if it is, then Dat would model linear bounded automata. If not, then it is also unknown if the self-modification feature would allow for Turing complete behavior in an unbounded variant. Like with the subset, if the self-modification is Turing complete, then Dat is a linear bounded automata.

User:stkptr suspects that the subset is Turing complete. A universal machine could potentially be constructed such that there are multiple sections separated by jumps to the beginning. In each section there is a starting component which undoes the prior section's work. The tape would be arranged such that every n cells for some n would be data storage, with the rest being head/program state.