Sugueziume (named after a procedurally generated galaxy in the game No Man’s Sky) is a self-modifying esolang by User:BoundedBeans with extremely weird operators, code-stored data, and queue-based code. It was inspired by _ and is a sequel to Execoil.
The name is of course procedurally generated gibberish by No Man’s Sky, however the author pronounces it “soo-gwez-ee-oom”
All storage in Sugueziume is strings. Strings are made out of capital letters and spaces. This includes the code.
Each entry in the queue is separated by a comma. All characters other than commas, spaces, and capital letters are ignored. Do not put spaces after the commas unless you want them in the queue. The first entry in the code is the front of the queue.
Execution repeats the following steps until the queue is empty:
- Dequeue an element and put it in the current string.
- Execute one command in the current string.
- Move the command pointer right.
- Repeat steps 2 and 3 until the command pointer is outside of the current string.
- Set the command pointer to 0.
(Space) - no operation A - dequeue and discard B - dequeue and enqueue C - enqueue everything after the C, set the command pointer outside of the current string D - dequeue two elements, enqueue them interleaved, with the characters alternating starting with the first dequeued. If they are different lengths, put spaces in the empty space E - dequeue an element, enqueue it twice F - dequeue u, v, w, x, y, z, enqueue v, w, x, y, z, u G - input a string, enqueue it. Remove any invalid characters H - dequeue a string, output it I - dequeue a string, if it contains an X, jump to the character after previous I, if it doesn’t, do nothing. J - dequeue a string, if it contains an X, jump to the character after the next J, otherwise, do nothing (Note for IJ, if the I is the first or the J is the last, do nothing) K - dequeue x and y. Enqueue x with only the characters in the positions where y contains an even letter (BDFHJLNPRTVXZ) L - dequeue x, y, z, enqueue y if x contains an odd number of characters, otherwise, enqueue z M - dequeue x, y, z, enqueue them all interleaved in the order dequeued. This is potentially necessary since doing interleave(interleave(x, y), z) will interleave more like xzyz, and eventually x(space)y(space) runs out N - dequeue x, then dequeue length(x) elements and interleave them all, enqueue the result O - halt the program P - dequeue x, enqueue the characters of x one by one Q - like p, but put the characters in reverse R - dequeue x, take the first and second characters, dequeue y, replace instances of the first character with the second, enqueue the result STUVWXYZ - no operation
Sugueziume is very likely Turing-complete, but this is hard to prove. Unbounded Minsky machine registers could be encoded with powers of 2 as the length of strings and interleaving strings with themselves, the only problem is whether the jumps in the language is a sufficient branch. One could attempt to simulate Bitwise Cyclic Tag, but you can’t enqueue just one part of the executing string, you must enqueue the entire thing after that point. Also, looping requires duplication, but then it would require getting to the back of the queue. One could use B a few times, but it’s difficult to dynamically calculate how many times to do that. Sugueziume’s computational class is thus currently unknown, but it does meet all criteria for Turing-completeness; it can loop by duplicating code, it can halt, it has conditional branches, it can access an arbitrary amount of memory, and it can have an arbitrary effect at an arbitrary point.
Prints in all caps and no punctuation.
Infinite printing loop
Should print: EEHEEHEEHEEHEEH… But I can't get it to work in my implementation for some reason.
X for true, anything else for false
Sugueziume++ is a variation of Sugueziume with extra features.
Base 27 numbers
Some operations use a base-27 number. In these numbers, space is zero, and the rest of the letters follow in order.
Sugueziume++ replaces the following no-ops with new commands. The space is guaranteed to always be a no-op.
|S||Dequeues an element with the length represented as a base-27 number. (This likely allows testing for any character, by the way.) It then dequeues that number of elements, then packages them up into a namespace and enqueues the namespace as a single-character element.|
|T||Dequeues an element, enqueues the first character of the element, enqueues the rest of the element. If the first character happens to be a namespace, enqueues all elements of the namespace (after both of the previous elements).|
|U||Takes the next element, evaluates it like a command string, but keeps remembering the spot that it was previously. It then returns to the calling command (the element called is deleted at this point.) Useful in namespaces for conditions where only a single command is executed.|
|V||Dequeues a base-27 number, outputs that as a Unicode character.|
|W||Inputs a Unicode character, enqueues it as a base-27 number.|
|X||Dequeues two strings, concatenates them.|
|Y||No-op, used as an indicator of communication (for SugueziNet and the ZM command).|
|Z||Depends on the next character.|
|ZA||Reserved for implementation-specific features. It is recommended that additional characters are used after the A to distinguish multiple custom commands.|
|ZB(namespace)||Executes the namespace until it halts, but redirects its output to a buffer. When the program halts, the buffer will be executed as a command-line command. The namespace also has a string enqueued to it before execution, which will be something like WINDOWS, MAC, LINUX, ANDROID, CHROME OS, etc.|
|ZC||Dequeues a string. Gets the content of the file with ".sugueziume" appended to the string as the filename. Inserts the contents of the file into a namespace and enqueues it as a single character string.|
|ZD||Dequeues two strings; if they are the same string, dequeues another command and executes it similarly to the U command, otherwise, simply dequeues the string.|
|ZE(character or namespace)||Enqueues the character or namespace as a single-character string.|
|ZF||Dequeues a string, throws an error with that string. If the error does not make it to any handlers, prints the message and halts. A message containing a single space will appear as a regular halt.|
|ZG(namespace)(namespace)(namespace)||Enqueues the string containing this command to the second namespace, executes it for one string, then dequeues an element from it for the error string. Executes the first namespace. If it throws an error, matches it against the error string. If they are equal, runs the third namespace, otherwise throws the same error. This is equivalent to a try-catch block.|
|ZH(namespace)(namespace)||Executes the first namespace. No matter whether there is an error or not, runs the second namespace. If there was an error in either one, throws the error. If there was an error in both, throws the error thrown by the second namespace. This is like a try-finally block.|
|ZI||Dequeues x, dequeues y, enqueues y, enqueues x.|
|ZJ||Dequeues a string, enqueues it to the parent namespace.|
|ZK||Dequeues a string and a namespace, enqueues the namespace with the string enqueued.|
|ZL||Dequeues a namespace, dequeues an element from that namespace, enqueues the element, enqueues the namespace without that element.|
|ZM(namespace)(namespace)||Runs both namespaces in a multithreaded manner. When both halt, execution will continue on the rest of this string. If there are multiple threads going on at once (no matter where or how many there are), sending a message starting with "Y Y" will enqueue it to all threads (but only in executing namespaces, not in their enclosing namespaces).|
|ZN(code)(space)(code)(space)||Peeks an element. If it starts with Y, run the second code, otherwise, run the first code. Spaces here are mandatory; they delimit the two code sections from each other and the remaining code. These can nest (my original specification says they can't but there are no current Sugueziume++ implementations or programs, so no incompatibility). A space only terminates the innermost ZN call. This is intended to allow the use of regular commands in SugueziNet programs, since those commands would not be able to differentiate the message, and there is no way to tell when a message will be received. In a SugueziNet program, most code should be contained within this command.|
|ZO(namespace)(namespace)||Runs the first namespace until it halts, except that if a string starting with Y is dequeued, the command dequeuing it will stop, enqueue the string to the second namespace (but before the second namespace runs, so that does not cause the string to be enqueued to other threads or clients), and run the second namespace for one string. An element will then be dequeued from the second namespace, and enqueued to the first namespace unless the element is a single space. The first namespace will then pick up where it left off.|
Namespaces are treated similarly to a single character, and can be in the same string as other namespaces or characters. They contain an entire queue, with the same structure as the main program.
- When inside of the namespace, the O command only causes the namespace to halt. ZF can be used for a true halt.
- When encountered by the instruction pointer (but not as an argument to another command, such as ZG), it runs the namespace until it halts.
- When a string containing namespaces is outputted, all of the namespaces are executed for one string after the string H is enqueued to each of them, then a string is dequeued and it is substituted for the namespace.
- A namespace is not an X for the purposes of commands I and J, and is not considered an even letter for the purpose of K.
- A namespace is counted as one character.
- Namespaces can be nested.
- There is no literal way to specify namespaces, they must be created during execution.
A server program can be made that Sugueziume++ programs can connect to (which is not in the language, but rather as you start the program). A SugueziNet client will typically also be a Sugueziume++ interpreter, but doesn't have to be. There is no standard server protocol (clients and servers should follow the same protocol, of course, but they should figure out the protocol themselves, and there may be multiple protocols, depending on which implementation you use).
Sugueziume++ programs send a packet to the server whenever a string starting with YY is enqueued. The contents of the string are then sent to the server, which sends the packet to all clients connected to it. All clients that are Sugueziume++ interpreters, when receiving this packet, should enqueue those contents to their queues (including the YY, for testing whether it was sent or not). It should always enqueue to the currently executing namespace, as well as all enclosing levels of namespace, but not any others. As for the one who sent the message, the enqueued string should be prepended with a space, so that a program can tell whether it sent or received a message. Note that these strings can include namespaces as well as regular characters, and they can also be nested. The message will not be enqueued in the middle of the command; it will wait until the current command finishes (this is so that there isn't a message embedded between the results of a command that enqueues multiple elements).
The SugueziNet server is intended to be more like a network than a server, acting as a proxy for multiple clients to interact. The server is meant to be more like the internet, and a Sugueziume++ program could be either a website or a browser in that analogy.