Dsii

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.

Dsii is a small Deadfish "self-interpreter" extension that supports interpreting Deadfish "self-interpreter", which itself is a small Deadfish extension that supports interpreting Deadfish.

Syntax

Accumulators a and b are equivalent to Deadfish "self-interpreter"'s corresponding accumulators, whereas array c immutably stores characters in an array defined by the length of the Dsii code with a pointer that points to somewhere in it.

Instruction Description Progenitor
a input into accumulator a Deadfish "self-interpreter"
i increment accumulator b Deadfish
d decrement accumulator b Deadfish
s square accumulator b Deadfish
o output accumulator b Deadfish
j jump back to the start of the program or to the previous j Deadfish "self-interpreter" / Novel
: if the character after : is equal to a, interpret that character as Dsii code, else, skip it. Deadfish "self-interpreter"
c put character in accumulator a into the next empty cell in accumulator c, and if the array is full, terminate Novel
e move the pointer of array c one step forward and if the new cell is longer than the array, terminate Novel
f jump to the character after the next j or terminate the program Novel
; if the character after ; is equal to that in a, interpret the character after that (so the character two characters after ;) as Dsii code, else, skip it Novel
, if the character after , is equal to that in c, interpret the character after that (so the character two characters after ,) as Dsii code on array c, else, skip it Novel

The increment and decrement operations are such that, if the accumulator becomes -1 or 256, it is reset to zero. If it is over 256, this doesn't apply.

Example programs

Deadfish interpreter

a:i:d:s:oj

Deadfish "self-interpreter" interpreter

cea;ac;ic;dc;sc;oc;jc;:ce;aj;ij;dj;sj;oj;jj;:jfj,aj,ij,dj,sj,oj,jj,:jfj,aa,ii,dd,ss,oo,jj,::ej

Note that this interpreter requires the input consist completely of valid Deadfish "self-interpreter" code, then at least one character of invalid Deadfish "self-interpreter" code.

The first loop puts one character of Deadfish "self-interpreter" code in c, moves to the next place, and jumps back. Notably, it puts a null character at the beginning of c. The second loop jumps back to the beginning of the code in c and starts interpreting it, going one character forward after interpreting. This is where the null character makes sense, because instead of skipping the first character after j, it just skips the null character.

(This might not work. It should be tested.)

Truth-machine

a;0ofj;1fjoj

It takes in one input.

If the input is zero, it outputs it.

It jumps to the next loop.

If the input is one, it jumps to the next loop. Otherwise, it stays in a loop where it doesn't print out anything.

In the next loop, it constantly outputs what's in the accumulator, i.e. 1.

Flawed + Interpreter

a;+ij

It increments the counter for every plus sign entered... until it reaches 256 and becomes zero again.

Computational Class

Dsii is not Turing-complete because:

  • it can't jump back to a previous loop
  • it can't change arbitrary memory at an arbitrary point (in fact, it can't change anything in c once it is written)
  • the amount of memory it can store is exactly equal to the length of the code

Whether it has any computational power at all is yet to be determined.

Implementations

Python