Sus
An esoteric programming language like BF.
IMPORTANT NOTE:
This now runs as it’s own standalone executable. If you don’t want to program “sus” in Roblox, then you may find the executable here:
What is it?
“Sus” is an esoteric programming language that is turing complete; think of it as an over-simplified BF. Unlike BF though, this is more simplistic and forgiving; this seems suspiciously too good to be true, but I promise, it works.
Like BF, this is based on an array and pointer. The pointer moves across an array and may increment/decrement values, and output that value as an ASCII character.
Sus is written with five symbols, which are documented below:
- “>” = Move pointer one spot forward in the array
- “<” = Move pointer one spot backward in the array
- “+” = Add to current pointer value
- “-” = Subtract to current pointer value
- “|” = Convert current pointer value to ASCII and add to output string
- “$” = If current pointer value is 0, skip past the next “!”
- “!” = Go back to the previous “$”
Any and all other characters are ignored when the program is compiled. Get creative with your code!
At the end of the code read, the interpreter prints the final output.
THE POINTER VALUE IS 97 BY DEFAULT! In a sense, this means each value in the pointer array will equal “a” as an ASCII value.
Why should I use it?
You shouldn’t use it. It’s useless.
Sus is an esoteric programming langauge. Esoteric programming languages are not intended for practical use in a program, but rather something for fun.
I recommend trying this out, though, if you would like to challenge your mind a bit, or impress a friend.
Examples
Here is an example printing “Hello world!”:
-------------------------|>++++|>+++++++++++||>++++++++++++++|>-----------------------------------------------------------------|>++++++++++++++++++++++|<<|>>>+++++++++++++++++|<<<<|>>>>>+++|>----------------------------------------------------------------|
Here it is broken down
-
-------------------------|
Go back to the ASCII value for “H,” and add to output -
>++++|
Go forward a cell, go to the ASCII value for “e,” and add to output -
>+++++++++++|
Go forward a cell, go to the ASCII value for “l,” and add to output -
|
The current pointer already equals “l,” so just re-add it to the output -
>++++++++++++++|
Go forward a cell, go to the ASCII value for “o,” and add to output -
>-----------------------------------------------------------------|
Go forward a cell, go to the ASCII value for space, and add to output -
>++++++++++++++++++++++|
Go forward a cell, go to the ASCII value for “w,” and add to output -
<<|
A couple cells ago, we already defined the letter “o,” so go back to it and print it -
>>>+++++++++++++++++|
Go forward three cells, go to the ASCII value for “r,” and add to output -
<<<<|
We already defined a value for “l,” so go back to that cell and print that value -
>>>>>+++|
Go forward five cells, go to the ASCII value for “d,” and add to output -
>----------------------------------------------------------------|
Go forward a cell, go to the ASCII value for “!,” and add to output
Also, per request of some acquaintances, here is an example that prints “chevvy”:
++|>+++++++|>++++|>+++++++++++++++++++++||>++++++++++++++++++++++++|
Source code
Want to try it out? You can nab the module for it here:
https://www.roblox.com/library/7072546345/Sus-Interpreter
Here is some example code running the examples above:
Example code
local Sus = require(script.SusInterpreter)
Sus:RunCode("-------------------------|>++++|>+++++++++++||>++++++++++++++|>-----------------------------------------------------------------|>++++++++++++++++++++++|<<|>>>+++++++++++++++++|<<<<|>>>>>+++|>----------------------------------------------------------------|") -- Hello world!
Sus:RunCode("++|>+++++++|>++++|>+++++++++++++++++++++||>++++++++++++++++++++++++|") -- chevvy
Or, you want the interpreter source code raw to tinker with? I have that for you too!
Source code
--[[
> = Move pointer by 1
< = Move pointer by -1
+ = Add to current pointer value
- = Subtract to current pointer value
| = Convert current pointer value to ASCII and add to output string
$ = If current pointer value is 0, skip *past* the next "!"
! = Go back to the previous "$"
--]]
local Sus = {}
local DefaultPointerValue = 97
function Sus:RunCode(Code)
local Array = {}
local PointerIndex = 0
local Reader = 1
local Jump = false
local Return = false
local Length = Code:len()
local Output = ""
local function ModifyValue(Amount)
if Array[PointerIndex] then
Array[PointerIndex] += Amount
else
Array[PointerIndex] = DefaultPointerValue + Amount
end
end
local FunctionRemaps = {
[">"] = function()
PointerIndex += 1
end,
["<"] = function()
PointerIndex -= 1
end,
["+"] = function()
ModifyValue(1)
end,
["-"] = function()
ModifyValue(-1)
end,
["|"] = function()
Array[PointerIndex] = Array[PointerIndex] or DefaultPointerValue
Output ..= string.char(Array[PointerIndex])
end,
["$"] = function()
Return = false
if Array[PointerIndex] == DefaultPointerValue then
Jump = true
end
end,
["!"] = function()
if Jump then
Jump = false
else
Return = true
end
end,
}
while Reader <= Length do
if Reader < 1 then
error("Reader out of bounds")
end
local Input = Code:sub(Reader, Reader)
if (not Jump and not Return) or (Jump and Input == "!") or (Return and Input == "$") then
local Function = FunctionRemaps[Input]
if Function then
Function()
end
end
if Return then
Reader -= 1
else
Reader += 1
end
end
print(Output)
end
return Sus
Closing note
Overall, this was just some fun side project for me. If you want to use it, go for it, and show me what you make in the replies below!
Thanks for reading! ^v^