Arsel
Arsel
Arsel (A Really Small Esoteric Language) is a simple, minimalistic language, made by User:Kirbyiseatinghumanmeat in January 2021 with only 3 instructions.
How it works
Arsel works like this:
It has an array that contains alphabetical characters (a, b, c, etc.), numbers (0, 1, 2, 3, etc.), and a blank space, that looks like this:
# Alphabetical chars (only supported lowercase) "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", # Numbers "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", " "
An integer called `pos` will point the character at the board according to its value. For example: if `pos` is 5, it's pointing at the `f` character. The language works around this `pos`, increasing or reset it depends on the instructions.
Instructions
Instruction | Effect |
---|---|
+ | Increase the `pos` by 1 |
0 | Prints the character at that `pos` |
< | Reset the `pos` to 0 ("a") |
Any other characters will be considered as comments.
Examples
Here is a simple program that prints "hello" in Arsel:
+++++++0< ++++0< +++++++++++0< +++++++++++0< ++++++++++++++0< ++++++++++++++++++++++++++++++++++++++++++++++0<
Here is the same in one line:
+++++++0<++++0<+++++++++++0<+++++++++++0<++++++++++++++0<++++++++++++++++++++++++++++++++++++++++++++++0<
Here is the same but shorter:
++++++0<++++0+++++++00+++0
The interpreter
Here is the interpreter of this language, written in Ruby. You need to run this with a filename as input e.g. ruby arsel.rb the_file.ars runs this interpreter with the input file is the_file.ars.
class Arsel def initialize(script) @script = script @pointer = 0 @board = [ # Alphabetical chars "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", # Numbers "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", " " ] @pos = 0 end def run() while @pos < @script.length current = @script[@pos] if current == "+" @pointer += 1 @pos += 1 elsif current == "0" print @board[@pointer] @pos += 1 elsif current == "<" @pointer = 0 @pos += 1 else @pos += 1 end end end end arsel = Arsel.new(File.read(ARGV[0])) arsel.run