From Esolang
Jump to navigation Jump to search
Paradigm(s) Imperative
Designed by User:ZippyMagician
Appeared in 2021
Memory system Cell-based
Computational class Turing-complete
Reference implementation Unimplemented
File extension(s) .cpy

cpy (from memcpy) is a Turing tarpit designed by User:ZippyMagician.


cpy is composed of instructions, separated by lines. These instructions come in the form

X <op> Y

, where X and Y are numbers and op is one of the following:

Op Description
-> Move [X] into [Y] and decrement if X > Y, else increment
<-> Copy [X] into [Y]
<- Jump to line X if [Y] > 0

Memory cells 0 and 1 are reserved. Writing a value to 0 will output the value and then clear that addr, and moving from one will give a byte of STDIN (whether this is the ascii code or a number is implementation defined). If this cell is cleared via a mov operation, it will be replaced with the next byte or a 0-byte if there is no more input. Memory is in the form of unsigned 8-bit numbers, initialized to 0. The maximum size of memory is undefined, but recommend to be at least 2^16 cells. All characters besides numbers and operators ignored


Cat program


Computational Class

cpy can be proven Turing complete by translation of Szewczyk notation for Minsky machine, which is a proposed notation for a minimalistic Minsky Machine syntax, such as the following program

1 -1
1 1
1 1

Translation can be accomplished as follows:

3 <- 3

for each X -1

X+4 -> X+4

for each X Y (# = line# 0-indexed)

#+2 <- X+4
Y+offset+1 <- 3

where offset must be calculated at translation time, such that it jumps to the start of the Yth command (which may or may not be the Yth line + 1, depending on whether the X Y command was used or not). Once finished, a transpiler written in Rust can be found Here.