nope
nope is a Cell-based Turing complete esoteric coding language created by User:yayimhere (rewritten by User:RainbowDash). nope supports negative numbers, this allows for addition and subtraction. anything thats not a command will be ignored. there exists labels like in BASIC but they can only be numbers In nope there is only 5 valid commands along with their arguments:
| Commands | Description | Arguments |
|---|---|---|
| no_op | Does nothing | * |
| jl | Jump to label if MP is less than or equal to zero | MP, LABEL |
| peek | Prints out the value at MP | MP |
| store | Store VALUE at MP | MP, VALUE |
| no:op_add | MP1 + MP2 = MP3 | MP1, MP2, MP3 |
Tips
- nope allows for subtraction whenever you add a negative number with another number.
- you can GOTO labels by choosing a cell you always know is going to be 0 or less.
- you convert numbers outputted by the peek command to ASSCI for text output or to colors for image output
Code Examples
Hello World
store 0 72 peek 0 store 0 101 peek 0 store 0 108 peek 0 peek 0 store 1 111 peek 1 store 0 32 peek 0 store 0 119 peek 0 peek 1 store 0 114 peek 0 store 0 108 peek 0 store 0 100 peek 0
Count down from 100
store 0 -1 store 1 1 store 2 100 store 3 -100 :1 peek 2 no:op_add 1 3 3 no:op_add 2 0 2 jl 3 1
This works because there is a negative of the number that is being incremented, the program stops once that number is equal to 1. While that is happening a positive version is being decremented and outputted giving you the output you see.
Implementations
JavaScript - nope revised interrupter
function nope(inputPrgm){
// Initialize Variables
let memorysize = 3000
let memory = new Array(3000).fill(0);
inputPrgm = inputPrgm.toLowerCase();
let words = inputPrgm.split(/[ \n/\\]+/);
let i = 0;
while (i < words.length) {
switch(words[i]) {
case "no_op":
Function.prototype();
break;
case "store":
memory[words[i+1]] = +words[i+2];
i += 2
break;
case "jl":
if(memory[words[i+1]] <= 0){
i = words.indexOf(":" + words[i+2]);
} else {
i += 2
}
break;
case "peek":
console.log(memory[words[i+1]]);
i += 1
break;
case "no:op_add":
Function.prototype();
memory[words[i+3]] = memory[words[i+1]] + memory[words[i+2]];
i += 3
break;
}
i++
}
}
Python interpriter by User:Ractangle
import sys;c=[0]*256;ops=[];pc=0
try:file=open(sys.argv[1]).readlines()
except(FileNotFoundError,IndexError):raise FileNotFoundError;exit()
for _ in file:[ops.append(i.lower())for i in _.split()]
while len(ops)!=pc:
if ops[pc]=="no_op":p+=1
elif ops[pc]=="jl"and c[int(ops[pc+1])]<=0:
x=ops[pc+2];pc=0
while ops[pc]!=f":{x}":
pc+=1
try:ops[pc]
except IndexError:print(f"No label number \"{x}\" was found")
elif ops[pc]=="peek":print(c[int(ops[pc+1])]);pc+=1
elif ops[pc]=="store":c[int(ops[pc+1])]=int(ops[pc+2]);pc+=2
elif ops[pc]=="no:op_add":c[int(ops[pc+3])]=c[int(ops[pc+2])]+c[int(ops[pc+1])];pc+=3
pc+=1
turing completeness proof
this is a proof that nope is turing complete to translating to Minsky machine
notes:
- registers 1, 2 and 3 and are reserved for inc, dec and unconditional jumps
- n is a short term for n'th command(of the minsky machine). so for the fifth command it would be n=5
- uses Extended Short Minsky Machine Notation
- Only five registers are needed to be Turing complete
so the program must start with:
store 1 -1 store 2 1
heres the translation:
℘xy | V :n jl y x no:op_add y 1 y -- ℘y | V :n no:op_add y 1 y ℘x: :n jl 3 x
the halt is not needed for turing completeness. so this prove's turing completeness of nope