BittyLang

From Esolang
Jump to navigation Jump to search

BittyLang is an esolang prompted by User:None1 and generated by the Cursor AI:

Commands

+ Increment the byte's value by 1.

- Decrement the byte's value by 1.

. Output the ASCII character corresponding to the current byte's value.

Examples

Hello, World!

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++.+++++++..+++.-------------------------------------------------------------------.------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++++++++++++++++.+++.------.--------.-------------------------------------------------------------------.

Output E

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.

Print 222

++++++++++++++++++++++++++++++++++++++++++++++++++...

This program is written by User:None1 himself, it is created since this is User:None1's 222nd esolang.

Interpreter in Python

def bitty_lang_interpreter(code):
    """
    A simple interpreter for BittyLang.
    
    Parameters:
    - code: A string containing the BittyLang code to execute.
    """
    # Initialize the byte to 0.
    byte = 0
    
    # Iterate through each character in the code.
    for char in code:
        if char == '+':
            # Increment the byte, ensuring it wraps from 255 to 0.
            byte = (byte + 1) % 256
        elif char == '-':
            # Decrement the byte, ensuring it wraps from 0 to 255.
            byte = (byte - 1) % 256
        elif char == '.':
            # Output the ASCII character corresponding to the current byte value.
            print(chr(byte), end='')
        else:
            # Ignore any other characters.
            continue