Supertape

From Esolang
Jump to navigation Jump to search

The whole program is made up of a main normal tape, containing some number of values, normal tapes, or cyclic tapes.

Here on out the current memory tape's pointer will be called the memory pointer, and the current instruction tape's pointer will be called the instruction pointer (keep in mind they can be the same)

Instructions

Instruction When ran with the memory pointer pointing at a tape When ran with it pointing to a character
< Move the memory pointer left Same
> Move the memory pointer right Same
v Set the memory tape to the tape pointed at by the memory pointer Who knows?
^ Set the memory tape to the tape containing the current memory tape Same
: Set the instruction tape to the tape pointed at by the memory pointer Who knows?
; Set the instruction tape to the tape containting the current instruction tape (doesn't change the pointer of either) Same
@ Duplicate the thing pointed at by the memory pointer, and point at the first one Same
$ Put the thing pointed at by the memory pointer in a new normal tape Same
& Put the thing pointed at by the memory pointer in a new cyclic tape Same
% Dump the contents of the tape pointed to by the memory pointer Who knows?
+ Replace the tape pointed at by the memory pointer with the sum of all elements in it (including elements in tapes inside it) Increment the value pointed at by the memory pointer
- Run '-' on all elements of the tape pointed at by the memory pointer Negate the value pointed at by the memory pointer
! Run '!' on all elements of the tape pointed at by the memory pointer, then output a newline if the tape is non-cyclic Output the value pointed at by the memory pointer as a Unicode character
? Take a line of input from the user, and insert a tape containing the values of each (not including the newline) at the memory pointer (pushing the prior thing pointed to to the right) Same

The instruction pointer prior to the instruction running always increments after the instruction is ran.
If, after incrementing, the IP is past the end of the tape, the IP gets reset to 0 and (if the instruction tape is not cyclic) the instruction tape becomes whatever previously held the instruction tape. This differs from a ';' break, because when the tape is left via semicolon it doesn't reset the IP. Other than that, it is the same.