NO WAY? NO WAY!

From Esolang
Jump to navigation Jump to search

NO WAY? NO WAY! (The name needs to be all caps.) is a programming language made by User:PKMN Trainer and is based on the Blue Spheres menu in Sonic 3&K.

Instructions

Instructions look like this:

(Instruction) (Number(sometimes missing)) \n

Numbers are written in binary, ? and 0 are substituted for NO WAY? and ! and 1 is substituted for NO WAY!. Here is a list of NO WAY? NO WAY! instructions.

Instruction Opcode Name Followed by Does
???? push Push Number in binary Pushes number to stack
???! pop Pop Pops from the stack and discards
??!? add Plus Pops 2 numbers, adds them, and pushes the result
??!! sub Minus Pops x and y, pushes y-x
?!?? jmp Jump Number in binary (n) Jumps to (n-1)th instruction. If n is missing, the address is taken from the stack
?!?! cmp Compare 2-bit number in binary (n) Pops x and y, pushes operation(n, x, y)
n operation(n, x, y)
00 x == y
01 x != y
10 x >= y
11 x < y
?!!? dup Duplicate Duplicate top of stack
?!!! deq Dequeue Dequeues and discards
!??? que Queue Pops a number and enqueues it
!??! sta Stack Dequeues a number and pushes it
!?!? inp Input Bit Pushes input (0 for num, 1 for char)
!?!! out Output Bit Dequeues number and outputs it (0 for num, 1 for char)
!!?? if If Jumps to else (or end if there is no else) if the front of queue <= 0
!!?! else Else Jumps to end if the front of the queue > 0
!!!? end End Ends if
!!!! halt Halt Halt program

Programs

Cat

True

NO WAY! NO WAY? NO WAY! NO WAY? NO WAY!
NO WAY! NO WAY? NO WAY? NO WAY?
NO WAY! NO WAY! NO WAY? NO WAY?
NO WAY! NO WAY? NO WAY! NO WAY! NO WAY!
NO WAY! NO WAY? NO WAY! NO WAY? NO WAY!
NO WAY? NO WAY! NO WAY? NO WAY? NO WAY!
NO WAY! NO WAY! NO WAY! NO WAY?
NO WAY! NO WAY! NO WAY! NO WAY!

Binary

1010 1
1000
1100
  1011 1
  1010 1
  0100 1
1110
1111

Assembly

inp 1
que
if
  out 1
  inp 1
  jmp 1
.
halt

Infinite loop

True

NO WAY? NO WAY! NO WAY? NO WAY? NO WAY?

Binary

0100 0

Assembly

jmp 0

Truth-machine

Binary

1010 0
0110
1000
1100
  1011 0
  0100 1
1101
  1011 0
1110
1111

Assembly

inp 0
dup
que
if
  out 0
  jmp 1
else
  out 0
end
halt

Computational class

Currently, the computational class for NO WAY? NO WAY! is unknown. Though it is likely to be Turing-complete. [[Category:Languages]