Grapheme is an esolang by User:PythonshellDebugwindow where the only valid characters are uppercase Latin letters.
Grapheme uses an unbounded stack, which can hold integers, strings, and functions. It also uses an untyped variable system, which maps integers/strings/functions to integers/strings/functions. Integers and strings are unbounded, integers are signed, and functions can be of any length.
Grapheme programs are made of a series of independent Latin uppercase letters, each one representing a command.
The default mode is normal mode, which uses the commands described in #Commands. The other modes are intmode, stringmode, and funcmode.
Normal mode and funcmode
|A||Pop A, pop B, push A + B|
|B||Pop A, pop B, push A - B|
|C||Pop A, pop B, set var A to B|
|D||Pop A, push var A|
|G||Pop A, execute A as Grapheme code (starts with and modifies the same stack and variables as the executing program, as if A was typed out as part of the code)|
|I||Pop A, if A is a function then execute A, else push A back|
|J||Pop A, push A as an integer (integer to integer = nop; string to integer = the same way as described in #intmode, even stopping conversion early if it hits an |
|K||Pop A, push A back, push A back again|
|L||Pop A, pop B, push A, push B|
|N||Pop A, push A as a string (integer to string = the reverse of the process described in #intmode, but using only |
|O||Pop A, if A is a string then push the length of A, else push A back|
|P||Reverse the stack|
|Q||Pop A, pop B, execute function A if A is a function and B is truthy (falsy values are zero, the empty string, and the empty function)|
|R||Pop A, pop B, push A ÷ B (floor division)|
|S||Pop A, pop B, push A × B|
|T||Pop A, if A is truthy then push the number zero, else push the number one|
|U||Pop A, skip the next instruction if A is falsy|
|V||Pop A, B, skip the next B commands if A is falsy|
|W||Push a user-input string|
|X||Pop A, if A is falsy then skip the next command, else skip the command after that (like an if-else statement)|
|Y||Pop A, output A|
|Z||Pop A, execute function A while the stack is not empty|
Initialize res to 0. For each character c in the "integer" (actually a list of uppercase Latin letters, just like the rest of the program), add
(ord(c) - 64) if c != "Z" else 0 to res and multiply res by 10. IMPORTANT: F can't be used, as it terminates intmode and there is no escape character.
Initialize res to the empty string. For each character c in the string, add it to res. Push res when done. Uppercase Latin letters are the only valid characters allowed in strings. IMPORTANT: E can't be used, as it terminates stringmode and there is no escape character.
When doing math (+/-/÷/×) on two strings A and B, the following Python code is essentially run:
ord((A or "\0")) <OP> ord((B or "\0")), replacing
<OP> with the operation. If A is a string but B is not, or vice versa, then only the string will get the ord conversion.
All capitals, with no punctuation or whitespace, and no "E" in "HELLO", as these are the constraints of the language.
This should print