Underload:^:^
Underload:^:^ is an esolang by User:BoundedBeans. It is a derivative of Underload, but with extra features.
New commands
Character | Semantics |
---|---|
W
|
Adds one to an integer counter. |
J
|
Prints the integer counter as a byte and resets the integer counter. This allows unmatched parentheses to be printed and makes binary output easier since you don't have to embed it into the source code. Unicode handling is up to the Underload:^:^ programmer. |
G
|
Takes in an input byte (call it x). Pops an element off the stack and replaces it with x concatenated copies of itself. Unicode handling is up to the Underload:^:^ programmer. |
]
|
Pops a Church numeral x off the stack, then a string, evaluates the string x commands later (commands evaluated by ^ count towards x).
|
[
|
Pops a Church numeral x off the stack, then a string, rewinds the state of the program (including instruction pointer) by x commands, evaluates the string, then resumes from that past point (commands evaluated by ^ count towards x). This command is disabled by default because it would cause interpreters to be painfully slow and memory intensive. To enable it, use T .
|
T
|
Toggle whether [ is enabled. If it goes from disabled to enabled, states before and during this command are not included in the command history, and jumping back to them will be an error. If it goes from enabled to disabled, all history will be deleted. This allows the programmer to choose when they need to travel back to, and put this command before it for a bit of a speed and memory advantage, and after the [ command to regain the memory.
|
\
|
Pushes !() if the interpreter supports [ , otherwise pushes the empty string.
|
/
|
Pushes the empty string if the interpreter supports [ , otherwise pushes !() .
|
@
|
Pops a string off of the stack, uses it as an ID for an extension command, executes the extension command. An extension-implementing interpreter should always behave equivalently to this specification until this command is run, but afterwards you can do whatever you want to the semantics and the language. |
Church numeral values for [
and ]
are determined by the length of the output of this program.
(I)([the church numeral string])^S
Interpreters might not support [
for traveling back in time. Underload:^:^ programs should accomodate this by either working around it or printing an error if they need/want to use [
. Encountering [
in an interpreter that does not support it should leave a generic error message that is the same as the error message for encountering any invalid command. The /\
commands should help support this with basic if statements, for if-else you can use:
([code if supported])/^^([code if not supported])\^^
Examples
Print ")("
(W):(:::*:**:*:*:**)^^J(::*:**:*:*:*)^^J
Time travel example (future)
((Hello, )S)(::::****)](Wor)S(ld)S(!)S
This actually prints WorldHello, !
Time travel example (past)
T(ha)S(ha)S(ha)S(({evil laughter})S)(::::****)[
This prints:
haha{evil laughter}hahaha{evil laughter}hahaha{evil laughter}haha...
indefinitely.
Note that in order to not have an infinite loop, you need to execute the [
conditionally. One weird way to do this is to put the [
inside parentheses and use ]
to insert !()
before the [
gets evaluated.