BitShift

From Esolang
Jump to: navigation, search

BitShift was created by user:Bas to reminisce the old days, when computers only understood zeroes and ones.

Language overview

A BitShift 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.

BitShift programs don't have any stack operations or loops. They have one single value which can be altered.
This value can range from 0-255 (0000 0000 - 1111 1111)

Instructions

BitShift supports the following instructions:

Alternations Description
1 Shift the value 1 bit to the left (0000 0001 > 0000 0010)
2 Shift the value 1 bit to the right (0000 0010 > 0000 0001)
3 XOR the value with 1 (0000 0000 > 0000 0001)
4 XOR the value with 128 (0000 0000 > 1000 0000)
5 Set the value to 0
6 Convert the value to a character and print it
7 Read a character from user input and set the value to it

Examples

Hello, World!

0100000100000101011010011011010100110100110100110101001010110010001001010111100110011110101001000000010101101111011110111011101101010001000101100101011111011101001010110111101110111101010001000010101111101101010

Cat

0101010010101

Interpreter

Official BitShift interpreter