We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Hashtag

From Esolang
Jump to navigation Jump to search

Hashtag is an esoteric programming language designed by User:Broxol to be a pain in the butt to program. It is also designed to be unreadable to anyone who dares try to come across it without knowing anything.

Just to give you a taste, here is Hello, World written in Hashtag:

code = "f##:_A>>>>>>>#a>>>>#>>>>>>>##>>>#N>>>>>>>>>>#>>#n----#a>>>>>>>>>>>>>>#>>>#------#a>>>#:f!:p"

FUNCTIONS

When editing string
Syntax Function
< Decrements pointer by one
# Appends what pointer is looking at to string
! Deletes top item of string
= Resets the string
a Sets the pointer to 0 (lowercase letters)
A Sets the pointer to 26 (capital letters)
n Sets the pointer to 52 (numbers)
N Sets the pointer to 62 (symbols/extra)
> Increments pointer by 1
Functions
Syntax Function
f##:…: Changes the string
f@#:…: Creates a variable (string) and sets it to value …
f!:p Prints string
f!:@ Prints variable string
f&&@ Allows user input, sets it to int and puts it in variable string
f&&# Allows user input and sets it to str
??(-) Jumps to variable string. If - is appended, jumps to end of program.
*@:…:(+-*/%) Does operations between var string and var …
?:…:(~$>)……; If statement, checks var string and … string, if false it skips over …… until it hits ;

INTERPRETER

code = "f##:_A>>>>>>>#a>>>>#>>>>>>>##>>>#N>>>>>>>>>>#>>#n----#a>>>>>>>>>>>>>>#>>>#------#a>>>#:f!:p"

code = list(code)

tape = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*(),. "
tape = list(tape)
tapePointer = 0
string = ""
global i
i = 0
var = {}

while i < len(code):
    if code[i] == "f":
        readfunc = []
        while code[i] != ":":
            i += 1
            if code[i] != ":":
                readfunc.append(str(code[i]))
        readfunc = "".join(readfunc)
        if readfunc == "##":
            i += 1
            while code[i] != ":":
                i += 1
                if code[i] == ">":
                    tapePointer += 1
                elif code[i] == "-":
                    tapePointer -= 1
                elif code[i] == "#":
                    string = string + tape[tapePointer]
                elif code[i] == "!":
                    string = list(string)
                    string.pop(-1)
                    string = "".join(string)
                elif code[i] == "=":
                    string = ""
                elif code[i] == "a":
                    tapePointer = 0
                elif code[i] == "A":
                    tapePointer = 26
                elif code[i] == "n":
                    tapePointer = 52
                elif code[i] == "N":
                    tapePointer = 62
        elif readfunc == "!":
            i += 1
            if code[i] == "p":
                print(string)
            elif code[i] == "@":
                print(var[string])
        elif readfunc == "::":
            break
        elif readfunc == "@#":
            store = string
            string = ""
            tapePointer = 52
            i += 1
            while code[i] != ":":
                i += 1
                if code[i] == ">":
                    tapePointer += 1
                elif code[i] == "-":
                    tapePointer -= 1
                elif code[i] == "#":
                    string = string + tape[tapePointer]
                elif code[i] == "!":
                    string = list(string)
                    string.pop(-1)
                    string = "".join(string)
                elif code[i] == "=":
                    string = ""
                elif code[i] == "a":
                    tapePointer = 0
                elif code[i] == "A":
                    tapePointer = 26
                elif code[i] == "n":
                    tapePointer = 52
                elif code[i] == "N":
                    tapePointer = 62
                assert tapePointer < 62, "tapePointer set to non-value"
                assert tapePointer > 51, "tapePointer set to non-value"
            var[store] = int(string)
        elif readfunc == "&&":
            i += 1
            user_input = input()
            if code[i] == "@":
                user_input = int(user_input)
                var[string] = user_input
            if code[i] == "#":
                string = str(user_input)
        elif readfunc == "*@":
            i += 1
            store = string
            while code[i] != ":":
                i += 1
                if code[i] == ">":
                    tapePointer += 1
                elif code[i] == "-":
                    tapePointer -= 1
                elif code[i] == "#":
                    string = string + tape[tapePointer]
                elif code[i] == "!":
                    string = list(string)
                    string.pop(-1)
                    string = "".join(string)
                elif code[i] == "=":
                    string = ""
                elif code[i] == "a":
                    tapePointer = 0
                elif code[i] == "A":
                    tapePointer = 26
                elif code[i] == "n":
                    tapePointer = 52
                elif code[i] == "N":
                    tapePointer = 62
            i += 1
            if code[i] == "+":
                var[store] = var[store] + var[string]
            if code[i] == "-":
                var[store] = var[store] - var[string]
            if code[i] == "*":
                var[store] = var[store] * var[string]
            if code[i] == "/":
                var[store] = var[store] // var[string]
            if code[i] == "%":
                var[store] = var[store] % var[string]
        elif readfunc == "??":
            i += 1
            if code[i] == "-":
                i = len(code)
            else:
                i = var[string]
    elif code[i] == "?":
        store = string
        i += 2
        while code[i] != ":":
            i += 1
            if code[i] == ">":
                tapePointer += 1
            elif code[i] == "-":
                tapePointer -= 1
            elif code[i] == "#":
                string = string + tape[tapePointer]
            elif code[i] == "!":
                string = list(string)
                string.pop(-1)
                string = "".join(string)
            elif code[i] == "=":
                string = ""
            elif code[i] == "a":
                tapePointer = 0
            elif code[i] == "A":
                tapePointer = 26
            elif code[i] == "n":
                tapePointer = 52
            elif code[i] == "N":
                tapePointer = 62
        i += 1
        if code[i] == "~":
            if var[store] == var[string]:
                i += 1
            else:
                while code[i] != ";":
                    i += 1
        elif code[i] == "$":
            if var[store] > var[string]:
                i += 1
            else:
                while code[i] != ";":
                    i += 1
        elif code[i] == ">":
            if var[store] < var[string]:
                i += 1
            else:
                while code[i] != ";":
                    i += 1
    else:
        i += 1