SDOTOS

From Esolang
Jump to navigation Jump to search

SDOTOS is an esoteric programming language created by User:Infinitehexagon.
Feel free to try to find the computational class of this language and make an implementation or an interpreter
SDOTOS has 16 commands, and 8 built in instructions.

Commands

Hexagon
Command Description
i Increment by the character next to it. If the character next to it is not a number 0-9, then increment the hexagon variable by the ASCII value of the next character.
n Decrement by the character next to it. If the character next to it is a non-number value, then increment the hexagon variable by the ASCII value of the next character.
f output the Hexagon variable as an ASCII character.
t multiply the Hexagon variable by the Stopwatch variable and save the result into Hexagon variable
e n go to line n if the Hexagon variable is non-zero.
h["name"] (commands) begin a definition for a function
x reverse the value in the Hexagon variable then store it into the Stopwatch variable.
g end a definition for a function (Both variables)


Stopwatch
Command Description
s increment the Stopwatch variable by 1
o output the Stopwatch variable as an ASCII character.
p set the Stopwatch variable to 0
w double the value of the Stopwatch variable
a Add the value of the Stopwatch variable to the Hexagon variable and store it into the Stopwatch variable.
c store the Stopwatch variable's value into the Hexagon variable's value.
! output the Stopwatch variable as a plain value
m decrement the Stopwatch variable by 1

Built-In Commands and Operators

Both
Command Description
\ output both variables as an ASCII character
? divide both variables by 2
% get the modulo of the Hexagon variable to the Stopwatch variable and store it into Stopwatch variable
# skip the next command if one of both variables contain 0.
u get input for hexagon variable
~ get input for stopwatch variable
: if the character next to it equals the Stopwatch variable as an ASCII character, then do the next command, but if not,skip to the next ":".
E loop to the line above it is either one of the variables is a non-zero value.
>["name"](value) create a new variable with the name and a value, and if the variable already exists then set it to a value

Keep in mind that already defined functions have to be marked in brackets so that you can call up functions.

Example Programs

Hello World program

iHfptiefptilofpiiofpti,fpti fptiWfptiofptirfptilfptidfpti!fpt 
//the "pt"s are used to set Stopwatch to 0, then multiply Hexagon by Stopwatch to set Hexagon variable to 0.

XKCD Random Number

ssss!

Truth-machine

h[$]ptg     //define a function named "$" and set the Hexagon variable to 0 
u#[$]        //check if hexagon is 0 from input and if so set both variables to 0
f          //output hexagon
e 3        //goto line 3

Cat program

uf

99 bottles of beer / 99 bottles of beer on the wall

sssssswwwsws!
ibfptiofptitffptilfptiefptisfpti fptiofptiffpti fptibfptieffptirfpti fptiofptinfpti fpt
itfptihfptiefpti
fptiwfptiafptilffpti,fpti fpt!pibfptiofptitffptilfptiefptisfpti fptiofptiffpti fptibfptieffptiri.fpt
iTfptiafptikfptiefpti fptiofptinfptiefpti fptidfptiofptiwfptinfpti,fpti fptipfptiafptisffpti fptiifpt 
i.fptitfpti fptiafptirfptiofptiufptinfptidfpti,fpti fptm!
ibfptiofptitffptilfptiefptisfpti fptiofptiffpti fptibfptieffptirfpti fptiofptinfpti fpt
itfptihfptiefptifptiwfptiafptilffpti.fpti fpt!
e 2
iNfptiofpti fptibfptiofptitffptilfptiefptisfpti fptiofptifffpti fptibfptieffptiefptirfpti fptiofptinfpti fptitfpt 
ihfptiefpti fptiwfptiafptilffpti.fpt

Nope. interpreter

iNfptiofptipfptiefpti.fpt/

calculator

h[add_numbers]u~a!g
h[subtract_numbers]u~
n1m
Eg
h[multiply_numbers]u~tg
h[divide_numbers]u~g
h[modulo_numbers]u~%g
u:+pt[add_numbers]!
u:-pt[subtract_numbers]a!
u:*pt[multiply_numbers]pa!
u:/pt[divide_numbers]pa!
u:%pt[modulo_numbers]!

SDOTOS is Plushie-complete

 ssss!     //Plushie-complete proof
 sssswwwm!p
 ss

Deadfish interpreter

sssswwwwmmoop
u:is:dm:si1ttpa:oo:
#E

blank / null character

pto

parity

h[is_even]iEfptivfptiefptinfpt
h[is_odd]iOfptidfptidfpt
~!cpss%
e 6
[is_even]
#[is_odd]pt