ElemScript
Elemscript is an esoteric programming language made by User:Areallycoolusername. All commands are carried out using the atom formulas for different elements (from the periodic table). It's stack based.
Specifics
For example, a water molecule's formula is H2O. So, you would put H-O-H as valid command in the language. The formula for hydrogen peroxide is H2O2, so the formula as a command is H-O-O-H. The first element in the periodic table is hydrogen, so all code must start with H. The last element in the periodic table is oganesson. However, since it has no known compounds, you just use Og for a command. All code must end with Og. Here is a chart with the commands so far.
Commands
Formula command | Operation |
---|---|
H-O-O-H (Hydrogen) | Starts code. |
C-C-C-C-C-C-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-O-O-O-O-O (Since paper has cellulose in it) | Prints anything after the command. |
Al-Al-Si-Si-O-O-O-O-O-OH-OH-OH-OH (Clay, since clay can be made into anything.) | Declares variable. Syntax: Command,var name,var value |
Og | Ends code. |
Implementations
This language is suppose to be HUGE. Therefore, the interpreter for this language will change for every five new elements added, until the entire periodic table is covered. Only printing is implemented for now. Here's the code.
#include <iostream> using namespace std; int main(){ string frst; getline(cin,frst); if(frst!="H-O-O-H"){ cout<<"No opening command."; return 69; } string snd; getline (cin,snd); if(snd!="C-C-C-C-C-C-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-O-O-O-O-O"){ cout << "No commands."; return 69; } string yeet; getline(cin,yeet); cout << yeet; string end; getline(cin,end); if(end!="Og") { cout << "No end command"; return 69; } else { return 69; } }
Hello World Program
H-O-O-H C-C-C-C-C-C-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-H-O-O-H-O-O-O-O-O Hello, world! Og