Mendeleev
Mendeleev is an esolang by User:BoundedBeans which uses weird chemistry-based expression syntax.
Labels
All lines start with a line label, followed by a colon and a space. (Blank lines are ignored, and so is leading and trailing whitespace.) A line label can be any valid expression, but is treated as a string instead of it's value. This means He and H2 are two separate labels, despite both meaning 2. The line labels don't matter to which order commands are executed in, it always runs from top to bottom. They only serve as a name to be Procrastinate-ed to. This also allows you to give descriptive names, rather than just giving them numbers. Labels don't even have to use actually declared variables, they just have to be valid Mendeleev expressions.
Expressions
Expressions use a chemical syntax. There are no literals, only variable names. However, the 118 discovered elements' atomic abbrieviations as of 2022 are initialized to the values 1-118. Variables names start with a capital letter and can contain up to two lowercase letters afterward.
Every variable name in the expression retrieves its value, and that value is then multiplied by an optional constant number after it. All of them are then added together to produce the final result. A constant can be preceded by a hyphen (-) to make it negative, allowing simulated subtraction. Putting subexpressions in parenthesis allows the result of those entire expressions to be multiplied by a constant additional times. Finally, the "->" operator, splits the expression into two, evaluates them both, and divides the first by the second. If there are multiple, the last "->" in the expression evaluates first, then goes through the chain leftwards (for example, Be->He->He seems like it would yield 1, since 4/2/2 = 1. However, it actually translates to 4/(2/2), equivalent to 4/1 or just 4. So Be->He->He = 4.) Any weird precendence issues with -> not allowing every expression can be solved by breaking it down into multiple expressions using variables to hold them, then combining them together. You cannot have any whitespace in an expression.
0 divided by 0 evaluates to 0. This is very important since dividing something by itself can determine whether it's nonzero.
Periodic tables
You can create alternate periodic tables, which are sort of like alternate systems of variables. You can access these in an expression with (table name)\\//(inner variable)
. This syntax can be combined with a number after it to multiply it. This can also be used in the name of a Discover, Research, or Recreate command. Additionally, a variable can have both a numeric value and subelements. A table can also contain other tables as its values, so you can create more complex hierarchies.
To get infinite storage, you can form kind of a stack out of a ton of pairs. You can do something like:
Discover Stk\\//A to be H19. Discover Stk\\//B\\//A to be H52. Discover Stk\\//B\\//B\\//A to be H10.
You can push with:
Discover Stk\\//B to be Stk. Discover Stk\\//A to be H304.
You can pop with:
Discover Pop to be Stk\\//A. Discover Stk to be Stk\\//B.
(As far as I know, this isn't really a part of chemistry, but it's required to make this language even have a chance at being Turing-complete, unless some better mechanism for unbounded storage exists)
Commands
Variables
Variables can be assigned with:
Discover (name) to be (expression).
You can actually redefine the prexisting elements to have other values. Variables can only contain signed integers and alternate periodic tables. The exact limit to them is implementation-dependant, meaning they could be a byte, short, int, long, or even an arbitrary-precision integer.
Flow control
This basically rips of the NEXT, RESUME, and FORGET system from INTERCAL, with the change that the next stack has no limit (unlike INTERCAL where there is a set limit of 79 entries).
NEXT can be written with:
Procrastinate until the synthesis of (expression).
FORGET:
Formulate (expression).
RESUME:
Continue synthesizing (expression).
I/O
Output as a Unicode character:
Share the discovery of (expression).
Output as a number:
Publish data concerning (expression).
Input as a Unicode character:
Research about (variable name).
Input as a number:
Recreate experiment concerning (variable name.).
Comments
A comment can be written with:
Write down (text).
Examples
No implementation exists currently, so these programs are all untested.
Hello world!
H1: Share the discovery of Hf. H2: Share the discovery of Md. H3: Share the discovery of Hs. H4: Share the discovery of Hs. H5: Share the discovery of Rg. H6: Share the discovery of Ge. H7: Share the discovery of OgH. H8: Share the discovery of Rg. H9: Share the discovery of Fl. H10: Share the discovery of Hs. H11: Share the discovery of Fm. H12: Share the discovery of As.
Truth-machine
H1: Recreate experiment concerning Tru. H2: Procrastinate until the synthesis of NexT1. NexT1: Procrastinate until the synthesis of NexT2. Tru1: Formulate H. Tru2: Publish data concerning H. Tru3: Procrastinate until the synthesis of Tru1. NexT2: Procrastinate until the synthesis of NexT3. Fal1: Publish data concerning H-2He. Fal2: Procrastinate until the synthesis of End. NexT3: Continue synthesizing TruH. End: Write down nothing.
FizzBuzz
Ini1: Discover Num to be H. Ini2: Procrastinate until the synthesis of MaiN1. MaiN1: Formulate H. MaiN2: Discover Opa to be Num. MaiN3: Discover Opb to be H15. MaiN4: Procrastinate until the synthesis of Mod1. MaiN5: Procrastinate until the synthesis of MaiN->FbA1. MaiN->FbA1: Procrastinate until the synthesis of MaiN->FbB1. MaiN->FbA2: Formulate H. MaiN->FbA3: Procrastinate until the synthesis of Main->B1. MaiN->FbB1: Procrastinate until the synthesis of MaiN->FbC1. MaiN->FbB2: Share the discovery of H70. MaiN->FbB3: Share the discovery of H105. MaiN->FbB4: Share the discovery of H122. MaiN->FbB5: Share the discovery of H122. MaiN->FbB6: Share the discovery of H66. MaiN->FbB7: Share the discovery of H117. MaiN->FbB8: Share the discovery of H122. MaiN->FbB9: Share the discovery of H122. MaiN->FbB10: Formulate He. MaiN->FbB11: Procrastinate until the synthesis of MaiN->End1. MaiN->FbC1: Continue synthesizing (Res->Res)1H. MaiN->B1: Formulate H. MaiN->B2: Discover Opa to be Num. MaiN->B3: Discover Opb to be H5. MaiN->B4: Procrastinate until the synthesis of Mod1. MaiN->B5: Procrastinate until the synthesis of MaiN->BA1. MaiN->BA1: Procrastinate until the synthesis of MaiN->BB1. MaiN->BA2: Formulate H. MaiN->BA3: Procrastinate until the synthesis of MaiN->F1. MaiN->BB1: Procrastinate until the synthesis of MaiN->BC1. MaiN->BB2: Share the discovery of H66. MaiN->BB3: Share the discovery of H117. MaiN->BB4: Share the discovery of H122. MaiN->BB5: Share the discovery of H122. MaiN->BB6: Formulate He. MaiN->BB7: Procrastinate until the synthesis of MaiN->End1. MaiN->BC1: Continue synthesizing (Res->Res)1H. MaiN->F1: Formulate H. MaiN->F2: Discover Opa to be Num. MaiN->F3: Discover Opb to be H3. MaiN->F4: Procrastinate until the synthesis of Mod1. MaiN->F5: Procrastinate until the synthesis of MaiN->FA1. MaiN->FA1: Procrastinate until the synthesis of MaiN->FB1. MaiN->FA2: Formulate H. MaiN->FA3: Procrastinate until the synthesis of MaiN->Num1. MaiN->FB1: Procrastinate until the synthesis of MaiN->FC1. MaiN->FB2: Share the discovery of H70. MaiN->FB3: Share the discovery of H105. MaiN->FB4: Share the discovery of H122. MaiN->FB5: Share the discovery of H122. MaiN->FB6: Formulate He. MaiN->FB7: Procrastinate until the synthesis of MaiN->End1. MaiN->FC1: Continue synthesizing (Res->Res)1H. MaiN->Num1: Formulate H. MaiN->Num2: Publish data concerning Num. MaiN->Num3: Procrastinate until the synthesis of MaiN->End1. MaiN->End1: Formulate H. MaiN->End2: Discover Num to be NumH. MaiN->End3: Procrastinate until the synthesis of MaiN1. C->Mul1: Write down || Multiplication subroutine. C->Mul2: Write down || This loops infinitely if you try to use 0 as the right hand operand. C->Mul3: Write down || but it's good enough for this program's purposes. Mul: Discover Res to be H0. Mul2: Procrastinate until the synthesis of Mul3. Mul3: Formulate H. Mul4: Discover Res to be ResOpa. Mul5: Procrastinate until the synthesis of Mul->H1. Mul6: Procrastinate until the synthesis of Mul3. Mul->A1: Procrastinate until the synthesis of Mul->B1. Mul->A2: Continue synthesizing He. Mul->B1: Discover Opb to be OpbH-1. Mul->B2: Continue synthesizing (Opb->Opb)1H. C->Mod1: Write down || Modulo subroutine. Mod1: Discover Opc to be Opa. Mod2: Discover Opd to be Opb. Mod3: Discover Ope to be Opc->Opd. Mod4: Discover Opa to be Opd. Mod5: Discover Opb to be Ope. Mod6: Procrastinate until the synthesis of Mul. Mod7: Discover Res to be OpcRes-1. Mod8: Continue synthesizing H.