Nybbleist

From Esolang
Jump to: navigation, search

Nybbleist is an esoteric programming language created by User:Zzo38 in 2006, where the only data type is a nybble.

There is a list of nybbles acting as both a stack and queue at the same time, and 2 variables X and Y that can store 1 nybble each.

Values

  • n = a nybble 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F or a variable X,Y. If you put multiple nybbles after a * or ! command, the command is executed once for each nybble in order.
  • v = a variable X or Y.
  • l = a label name consisting of one or more nybbles (some can be X or Y).
  • d = a (definition) label name consisting of one or more nybbles, but no X or Y.

Commands

  • *n Push/enqueue value n onto/in the stack/queue.
  • <v Dequeue a nybble from the queue and store it in variable v.
  • >v Pop a nybble from the stack and store it in variable v.
  •  ?v Input a nybble and store it in variable v.
  •  !n Output the nybble n.
  • @ End execution.
  •  :d Define the label d.
  • #l Jump to a label. If you jump to a label that doesn't exist, it is an error.
  •  %l Jump to a label, only if the stack/queue is empty.
  • +vn Add nybble n to the value of variable v (discarding all unused bits).
  • -vn Subtract nybble n from the value of variable v (discarding all unused bits).
  • ^vn XOR nybble n to the value of variable v.
  • &vn NAND nybble n to the value of variable v.
  • [ ] Perform the commands inside the brackets using a new stack/queue, starting as empty. (The old stack/queue is restored at the end.) You may not jump into or out of a set of brackets.
  • [ ]d You may put a label name at the end of a set of brackets. A jump to the label acts as a subroutine, returning after executing the commands inside the brackets.
  • | (Inside a set of brackets) Replace the stack/queue with what it was just before the end of the previous execution of this set of brackets.
  • $ Swap variables X and Y.
  • ~vl Divide value of v by 2, if remainder then goto label l.

Examples

Copy input to output:

:0?X!X#0

Hello World:

!48656C6C6F20576F726C6421@

Input a character output character before it in ASCII set:

?X?Y-Y1#Y
:0:1:2:3:4:5:6:7:8:9:A:B:C:D:E!XY@
:F-X1!XY@

Another shorter example to do the same as previous one:

?X?Y*X~X1~X1~X1~X1<X-X1*X:1>X-Y1!XY@