CopyPasta Language
A program copies lines to a clipboard, edits it by character position, and pastes it once at the end.
Rerednaw, 2018 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 4 known programs · Test method
Run it
The idea
Rerednaw made CopyPasta Language in 2018, after the copypasta meme. The only memory is the clipboard and the only output is pasting it, which also ends the program. The first version, Ctrl+C, can copy, duplicate and paste. The Ctrl+V version adds deleting, shifting characters, comparing two characters and a goto, and with those it computes.
The machine
Every command is a line, and its argument is the line after it. Characters and lines count from 1.
| Command | Argument | Does |
|---|---|---|
Copy | a line of text | Add the text to the clipboard |
CopyFile | TheFuckingCode | Add the program's own source |
Duplicate | n | The clipboard becomes n + 1 copies of itself |
Pasta! | Print the clipboard and stop | |
CoolStoryBro | a b | Delete characters a to b |
Creepy | a b n | Add n to the codes of characters a to b, modulo 256 |
IfAndOnlyIfAndOnlyIfAndOnlyIf | a b | Run the next command only if characters a and b are equal |
BUTI'MNOTDONEYET | n | Go to line n |
Example
The second is the cheating quine.
The second is the cheating quine. It copies its own source.
The mini Fibonacci from the specification keeps the numbers as digits in the clipboard, ---- 0 1 1 0 0 0 0 0, and adds with Creepy, which moves a digit's character code up or down by one. Each round counts one number down to 0 while it counts the next one up, and then deletes two dashes. After two rounds the clipboard is 0 0 0 2 3 0 0 0, and CoolStoryBro cuts it down to the two new numbers.
Patterns it teaches
- String rewriting: all state is one string, edited by position.
- Quine: a command that reads the source makes the quine trivial.
See also
Also in Jokes
Write your own in Run Convert a program from CopyPasta Language
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: copypasta-language.
Command line
shib run copypasta-language -e 'Copy
Hello, World!
Pasta!'shib manual copypasta-languageSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/copypasta-language.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org