ShiftbB
Jump to navigation
Jump to search
ShiftbB (meaning "Shift bit Byte") is a cell-based esoteric programming language that uses 2 data units without explicit types: bits and bytes. The move pointer instructions are bit-sized and most of the other instructions are byte sized. The current byte is from your_position to your_position+8. Because there are no proper increment/decrement operators, setting a value involves manually setting the bits, and an "overflow region" where any extra data is destroyed.
Instructions
Instruction | Scope | Action |
---|---|---|
, | Bit | Decrement instruction pointer |
. | Bit | Increment instruction pointer |
1 | Byte | Sets the current byte to 0x00 |
2 | Byte | Sets the current byte to 0xff |
_ | Byte*2 | Print operator. Prints previous byte as ASCII char if current byte is 0x00, prints previous byte as hex value if current byte is 0xff |
/ | N/A | Ends the program. Programs without this as the last instruction are undefined, and will segfault on the reference implementation |
@ | Byte | Sets the current position as the return, and sets the current byte as the left operand for a comparison |
= | Byte | If current left operand == current byte, return to return |
? | Byte | Sets current byte to user input |
Examples
Hello World
1.2.1..2.1...1_.2..1..2.1.2.1_.2..1.2..1..1_.2..1.2..1..1_.2..1.2....1_..2.1.2..1..1_..2.1.....1_.2.1.2.1.2...1_.2..1.2....1_.2...1..2.1.1_.2..1.2..1..1_.2..1..2.1..1_..2.1....2.1_/
Cat
This implementation only allows 1 char at a time.
?........1_/
Truth Machine
If input is 1, loop. Else, halt.
?@........1_,,,,,,,,1..2..1...2,,,,,,,=/
Implementation
Reference implementation is at https://gitlab.com/KSPAtlas/shiftbb