Binerdy

From Esolang
Jump to navigation Jump to search

Binerdy was created by user:Bas to reminiscence the old days, when computers only understood zeroes and ones. The name is a derivative of Binary and nerd, because programming in Binerdy is an art in itself.

Language overview

A Binerdy program only knows of 2 valid instructions, 0 and 1. Other characters are invalid and will thus throw an error on execution. Instructions are interpreted as alternating 0's and 1's. Whenever 2 of the same instructions are entered, the program will count the alternating instructions preceding it and perform a command. It doesn't matter if you start your program with a 0 or a 1.

0101011010011101011 will perform the instructions 6, 4, 2, 1, 5, 1

010101 1010 01 1 10101 1. Here, the non alternating characters have been seperated by a space for improved readability.

Because stacks should be clear after executing code to conserve all precious memory, Binerdy will bluntly dump all data still on the stack after execution.

Instructions

Binerdy supports the following instructions:

Alternations Name Description
0 exit Stop execution. Only happens when the program has a length of 0
1 init Add 0 to the top of the stack.
2 inc Increases the top stack value with 1, overflows to 0 at 256
3 dec Decreases the top stack value with 1, overflows to 255 at -1
4 add Removes the top stack value and add it to the second stack value. This will be the new top stack value
5 sub Removes the top stack value and substract it from the second stack value. This will be the new top stack value
6 label Removes the top stack value and turns it into a label
7 je Removes the top stack value and stores it as label to jump to. Removes next top stack value and compares it to the stack value after that. If equals, jump to label
8 jne Removes the top stack value and stores it as label to jump to. Removes next top stack value and compares it to the stack value after that. If not equals, jump to label
9 input Stores user input at the top of the stack
10 swap Swap the 2 top stack values
11 print Read the top stack value, interpret it as character and print it
12 char Read the top stack value and print it
13 rem Remove the top stack value

Examples

Hello, world!

001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001010101010011001100110011001100110011001100110011001100110011001100110101010101100110011001100101010101001010101010011001101010101011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011010101010110110110110110110110110110110110110110101010101100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110010101010100100100100100100100100100101010101001100110101010101101101101101101101101010101011011011011011011011011011010101010110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110110101010101101101101101101101101101101101101101101101101101101101101101101101101101010101011010101010101

Quine

0

Cat

A cat program which executes a single time is implemented in the following:

1010101011010101010100101010101010

An infinitely operating version is realized in

001010110101010110101010101001010101010100000101010

Truth-machine

A truth-machine implementation is defined by

0101010100010101101010101010001110101011010101010101

Interpreter

Official Binerdy interpreter(dead link)

Common Lisp implementation of the Binerdy programming language.