Thursday, October 1, 2015

Esoteric - Simplex

No, no, no, not a simplex. I mean Simplex. Simplex is a single-char programming language, that is, all of its commands are single characters. I'll give a list of commands. Note that there are missing characters. These are either non-serious commands or are unimplemented.
Char Description
A    Adds the current byte to the previous byte and removes the current byte, decrements pointer
B    Converts the byte to binary
C    Asks for input and outputs it
D    Sets the current byte to twice its value
E    Raises the previous byte the (current byte)th power and removes the current byte, decrements pointer
F    Goes back n characters in the source code. Deletes the current byte.
G    Asks for single-char input and Manhattan-adds it to the current byte
I    Increments the byte
J    Binary left-shift
K    Binary right-shift
L    Goes left a byte
M    Decrements the byte
N    Goes (current byte) bytes backwards in the strip.
O    Goes to the (current byte)th position in the source code
R    Goes right a byte
S    Subtracts the current byte from the previous byte and removes the current byte, decrements pointer
T    Multiplies the previous byte by the current byte and removes the current byte, decrements pointer
U    Sets the current byte to half its value
V    Divides the previous byte by the current byte and removes the current byte, decrements pointer
W    Converts character to lower case (ASCII only)
X    Sets the current byte to a random integer from 0 to the current byte
Y    Floors the current value
Z    Converts character to upper case (ASCII only)
0-9  Manhattan-adds the number to the current byte (a+_m b=10a+b).
a    Make the number negative
b    Asks for input that will store each character into a byte on the strip in order.
c    Copies the current byte to the next byte and increments the pointer.
d    Reverses the entire strip/tuple (tuple check first)
e    Manhattan adds e = 2.718281828459045… to the stack.
f    Turns off safety mode.
g    Clears the strip and outputs it as ASCII characters.
 Tuple: deletes the tuple and output its characters as ASCII.
i    Asks for input as a number and stores it.
j    Inserts a new cell at the pointer, pushing everything right.
k    Skips the next command
l    Writes the number of non-empty cells in the strip to the current cell
m    Writes the index of the pointer to the cell
n    Logically negates the current byte
o    Outputs the current byte as a number
p    Silent prime detection
q    Checks for membership in a tuple (tupleByte member <=> member IN tupleByte)
 Like this:
   (t1,…,tN) M → (q) → (t1,…,tN) C
 C is whether (1) or not (0) M in (t1,…,tN)
r    Reverses the current number, removing leading zeroes. (1000→1)d
s    Outputs the current byte as a string character
t    Applies the next character's function (support […]) to every member of the current strip.
u    Increments the strip number
v    Decrements the strip number
x    Proceed (confirms)
y    Takes the current byte n and takes the n previous entries and pushes it into a tuple, then storing the tuple in the byte n bytes away OR if the current byte is a tuple, expands the tuple into n bytes (inclusive of the current byte, going out.)
z    Resets the byte to zero
|    Traverse the stack in the opposite direction
%    Modulo
?    Skips the next command if the byte is zero.
[…]  Block statement. Read by ? as "one character".
{…}  While loop. Execution continues until the current byte is zero.
!…!  Comments.
#    Stops evaluation
;    Pushes the current character to the outer program (ability to compile to itself); if there are characters on the outer program at the end of execution, evaluates the outer program as the inner program.
`    Suppresses evaluation of outer program and instead outputs it.
=    N = current index. S = strip. S[N] = S[N] == S[N-1] (Equality testing)
>    N = current index. S = strip. S[N] = S[N] > S[N-1] (Inequality testing)
<    N = current index. S = strip. S[N] = S[N] < S[N-1] (Inequality testing)
"    Toggle string-parsing mode. In string-parsing mode, char codes are written to the current byte and the pointer incremented. E.g., "Alive" would write values 65, 108, 105, 118, 101 to the current byte, the byte after that, etc.
(…)n Repeats … n times (pre-code compilation). If left off, assumed to be repeated once.
~~   Comment (pre-code, single-line)
Here are some example programs:

BF Interpreter

Since there is a surjection from Simplex to BF, BF can compile to Simplex. The compiler can be written in simplex:

br{j">"=?[v"R";Ru]"<"=?[v"L";Ru]"+"=?[v"I";Ru]"-"=?[v"M";Ru]"."=?[v"s";Ru]","=?[v"G";Ru]"["=?[v"{";Ru]"]"=?[v"}";Ru]LL}

Hello, World!

"Hello, World!"g

1 comment:

  1. Je veux que vous sachiez tous qu'il existe un remède pour (l'herpès génital). J'ai vécu avec l'herpès pendant 2 ans et je n'ai pas pu obtenir mon traitement.J'ai essayé différents médecins et je n'ai pas pu me donner le remède, ils m'aident à le supprimer mais ce n'était pas ce que je voulais, je veux être exempt de ce virus était tout ce dont j'avais besoin d'eux. Il y a une semaine, mon ami m'a présenté ce grand herboriste appelé Dr Imoloa et m'a dit comment cet homme a guéri les gens de toutes sortes de maladies verrues génitales, hépatites B et c, VIH, cancer et me conseille de le contacter, souhaite Je l'ai fait, et il a répondu quelques minutes plus tard et m'a dit quoi faire pour que je puisse obtenir le médicament à base de plantes dès que possible. J'aimerais qu'il m'envoie via le service de messagerie DHL. Et il m'a dit comment prendre les médicaments si je voulais faire un suivi. Quelques semaines plus tard, le bouton de fièvre autour de ma bouche avait disparu lorsque je suis allé le confirmer si j'étais vraiment guéri, voici l'herpès génital qui me rongeait depuis 2 ans avait disparu avec le pouvoir de guérison à base de plantes que j'avais reçu du Dr. Imoloa. Ce grand homme a également guéri de toutes sortes de maladies incurables telles que la maladie d'Alzheimer, la maladie de Parkinson, le cancer du vagin, l'épilepsie, les troubles anxieux, les maladies auto-immunes, les maux de dos, les entorses du dos, les troubles bipolaires, les tumeurs cérébrales, les tumeurs malignes, le bruxisme, la boulimie, le disque cervical Maladie, maladie cardiovasculaire, néoplasmes, maladie respiratoire chronique, trouble mental et comportemental, fibrose kystique, hypertension, diabète, asthme, arthrite inflammatoire auto-immune ed. maladie rénale chronique, maladie inflammatoire des articulations, impuissance, spectre alcoolique feta, trouble dysthymique, eczéma, tuberculose, syndrome de fatigue chronique, constipation, maladie inflammatoire de l'intestin, maladie du lupus, ulcère buccal, cancer de la bouche, douleur corporelle, fièvre, hépatite ABC, syphilis, diarrhée, VIH / SIDA, maladie de Huntington, acné du dos, insuffisance rénale chronique, maladie d'Addison, douleur chronique, douleur de Crohn, fibrose kystique, fibromyalgie, maladie inflammatoire de l'intestin, maladie fongique des ongles, maladie de Lyme, maladie de Celia, lymphome, dépression majeure, maligne mélanome, manie, mélorhéostose, maladie de Ménière, mucopolysaccharidose, sclérose en plaques, dystrophie musculaire, polyarthrite rhumatoïde. Vous pouvez le joindre par e-mail via drimolaherbalmademedicine@gmail.com / whatsapp +2347081986098 Site Web-http / www.drimolaherbalmademedicine.wordpress.com

    ReplyDelete