JavaCode7
Posted on June 1, 2021
I have posted about esolangs a lot in the past. From good ones to mine to the esolist but never have I posted about making one.
In this article, I am going to go through a step by step procedure to make an esolang like loo. It is a simple language with only 4 commands. +
to increment the value of the one variable it can hold, -
to decrement, #
to print out the value in ascii form (e.g. 97 would be the lowercase letter a) and finally ;
stops the program. I will be making this in python but you can use any language you like.
Note
This is not the only way to create an esolang and it is not the only syntax for one. There are many types, each with their own peculiarities. I recommend looking at esolangs.org to see these.
Step 1: Accepting the code
This code takes in input from the user that should contain the loo code. It also sets up the variable for the value that loo holds.
value = 0
code = input("Enter your loo code here please > ")
Step 2: String to List
This block of code basically splits the loo code string into a list that will be iterated through later.
lexed = []
for i in code:
lexed.append(i)
Step 3: Execution
Now we iterate through the lexed
list and execute the code.
for j in lexed:
if j == "+":
value += 1
elif j == "-":
value -= 1
elif j == "#":
print(chr(value))
elif j == ";":
quit()
It is as simple as that! I hope you enjoyed this and hopefully I will post again soon.
Posted on June 1, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.