2/9 of an esolang

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.

2/9 of an esolang is an esolang made by User:Cortex in order to make doing anything relatively easy, but long-winded and inconvenient.


Every line of code must be exactly 7x(x is every value) commands, the first 6 of which (excluding the first commands) are ignored, but still must be syntaxically correct. Also, the first character of every line must be equal to the result of the JavaScript expression String.fromCharCode((130*[line number])+6), where the number of the first line is zero.


Character What it does
% Push the number 2/9 onto the stack.
Divide the top stack value by 8.
4 Multiply the top stack value by 24.
Q Add the top 2 stack values, then subtract 4.
@ Print "Hello, World!".
6 Print the top stack value as an ASCII character.
# Wait 3.5 seconds.
(i.e. U+202E RIGHT-TO-LEFT OVERRIDE) Reverses the order of the top three stack elements, then pops a stack element and jumps to the nth line, where n is the popped element.
÷ Take the top stack element modulo the second stack element, then square the result.
I'll make this good later but for now here's this. If ais523 is reading this then go ahead and add stuff cause im out of ideas. Just keep this message here Example
Example Example
Example Example
Example Example
Example Example

Additions by User:BoundedBeans

Character What it does
! Pops two items off the stack and pushes 19/92
` Changes the entire programming language into Unlambda for the rest of the program, except:
  • it only has `, s, k, and .(character)
  • all of the arguments to s and k are put backwards
  • s and k accept 17 extra curried arguments that do nothing
  • .(character) accepts 24
  • those extra arguments must contain at least 15 levels of apply nesting
  • every character must be delimited by a newline
  • every 5 characters (not counting newlines), the next 2 characters are completely ignored
  • outputting the letter e (capital or lowercase) crashes the program (though other threads will still run), forcing your output to be lipogrammic
c Creates two new threads, executing interleaved characters between the three programs from now on. The main thread is still 2/9 of an esolang, but the first new one runs brainfork and the other new one runs 2dFish. If the main thread further forks, more interleaved programs will be added. Putting in the character - or s will terminate a thread. Yes, this means you cannot square in 2dFish or decrement in brainfork (this is intentional). 2dFish and Brainfork can act on the full characters, as they read the full thing into memory. Also, the Y command in brainfork is required to occur every 25th character. Also, if the Y command is brainfork is executed, it starts the following threads, also interleaved (along with starting a brainfork thread as normal): Thue, Funciton, Chef, and Shakespeare. Threaded Thue, Funciton, Chef, and Shakespeare code must be complete by the time the program ends. In these extra four, they must be ended by $, not - or s.
Ѭ Inputs a byte n, pushes the nth prime number onto the stack. (Such as, 1 pushes 2, 2 pushes 3, 3 pushes 5, etc.)
(filename) Imports a library as a function similar to Xi-816's {} command. This is parsed as a single command for purposes of line length.
(command name) Runs an unofficial extension command. This is parsed as a single command for purposes of line length.

How interleaved programs are parsed

The program is parsed into commands before executing. Most commands are just a single character, but a few have other things.

Commands that switch the language include the entire rest of the code as part of the command. If it occurs on a position in the line that is not a possible last position (meaning not a multiple of 7), the remaining n commands to get it up to that point are set to the last n characters of the program that switched its language.

The c command or other commands that create interleaved programs parse the extra programs as part of the command, and the 2/9 of an esolang code as further commands. If a program starts more programs, the interleaving is nested. Any new programs are only executed when the command that created them actually runs. If a character in the position of a program ends with its ending character (s, -, or $), it drops out for the remainder of the program. When a new interleaved program is added, the assignment of the next character should reset to the first program in the interleaving order (which should always be 2/9 of an esolang or something replacing it, since there is no thread ender command for 2/9 of an esolang), and the new program is appended to the order.

As an example:

  • A program uses the c command to start brainfork and 2dfish. For the remainder of the program, characters where (position - position_of_c_command) % 3 equals 0 are 2/9 of an esolang, if equal to 1 then brainfork, if equal to 2 then 2dfish. The programs are preread from the code, so this does not cause programs with 2dfish's 2d nature.
  • A character parsed as 2dfish is s or -. 2dfish now drops out. 2dfish can still execute that command in its thread though. For the remainder of the program, characters where (position - position_of_s_command) % 2 equals 0 is 2/9 of an esolang, if equal to 1 then brainfork.
  • A character parsed as brainfork is Y. Thue, Funciton, Chef, and Shakespeare are started. For the remainder of the brainfork program, characters where (position - position_of_Y_command_in_brainfork) % 5) equals 0 is brainfork, if equal to 1 then Thue, if equal to 2 then Funciton, if equal to 3 is Chef, if equal to 4 is Shakespeare. These programs are all pre-read as part of their Y command, and are only started when brainfork executes its corresponding Y command.
  • PrySigneToFry's command is then executed on the 2/9 of an esolang program, so it has been replaced with Python. However, the Python program simply replaces 2/9 of an esolang, so the brainfork thread and its four subthreads are still there, interleaved with the Python program.

I think the algorithm for this would be to make a list of all interleaved programs, alternate through the elements of the list, and check for characters that remove the current element's program that are not in a different language in a nested thread. Represent nested interleaving as a nested list or something like that, alternating that list also but only each time it hits that turn on the containing list. Add a new element to the list and reset the position of the pointer in the list when a program is added, and remove a program from the list when it hits the ending character while the pointer is on that program (or, if it is a nested list of subprograms, the first element of that list).

2/9 of an esolang's line length restrictions apply to parsed commands rather than characters now, so other interleaved programs do not have to follow those restrictions and they don't have to follow a collective limit either. For interleaving purposes, a newline is considered a regular character and must be interleaved like anything else.

Additions by User:Xyzzy(hi!)

most of them are weird
Character What it does
changes the programming language into Literally every golflang ever.

Additions By User:Xi-816

Character What it does
T Run the Truth-machine program
{} Create a function, and add it to the stack (BoundedBeans clarification: this is parsed as a single command for purposes of line length, and may contain newlines inside. It's possible for this to contain interleaved or replacement programs inside (parsed as commands inside the function), but the curly brackets inside must be matched throughout the whole code across the interleaving)
& Comment (to a newline)
a Run a function as an AGSPL code.
f Run a function as a code of 2/9
] Find a factorial of an input

Addition by User:PrySigneToFry

Character What it does
Print a random number
Z[comments] Print the comments (BoundedBeans clarification: this is parsed as a single command for purposes of line length, and may contain newlines inside)
З Pop two item off the stack and push 12345/41023 (Warning: It is not the 3 but Ze in Russian)
撅[comment] Change top item of the stack to comment (BoundedBeans clarification: this is parsed as a single command for purposes of line length, and may contain newlines inside)
Change programming language to Z++
Change programming language to Python
Change programming language to HUH?.png
Print "2/9 of an esolang" (Warning: It is not J but Gu in Tsalagi)
Wait for 4.5083444444444444444444444444444444444444444444444444444 seconds.
Empty Operation.
Empty Operation, too.
N Define a number.

Programming tips

How to get numbers

((2/9) / 8 * 24) / 8 * 24 makes 2.
((2/9) % (2/9))^2 makes 0.
(2/9) * 24 / 8 * 24 / 8 * 24 / 8 * 24 / 8 makes 18.
18 + 2 - 4 makes 16.
16 + 0 - 4 + 0 - 4 makes 8.
8 / 8 makes 1.
1 * 24 makes 24.
(((24 / 8) + 8 - 4) + 2 - 4 makes 5.

From there, you can make any natural number by adding 5 to a number n and subtracting 4, which results in n+1 (a basic increment operation).


Branching is tricky for two reasons:

  1. Lines have character limits (although this was changed by PrySigneToFry to make any multiple of 7 characters work, then changed from characters to commands by BoundedBeans)
  2. The RIGHT TO LEFT OVERRIDE command is really weird.

The first can be circumvented with Xi-816's {} command, if the first limit is even implemented (the first limit is now inconsistent with the spec as defined by PrySigneToFry and BoundedBeans), which counts as one command and can expand the line to as many commands as desired with proper nesting and use of the f command.

The second can be fixed like this:

  1. Create two dummy elements of (2/9) on top of the branch index.
  2. Run the RIGHT TO LEFT OVERRIDE command.
  3. At the point branched to, use the ÷ command to form 0.
  4. Form 8 from the instructions in the How to get numbers section.
  5. Add 0 + 8 - 4 to get 4.
  6. Add 4 and subtract 4 to whatever is below on the stack to finally pop those two extra elements without affecting stuff below.


It's possible to cheat this language by just using Xi-816's {} and a to execute AGSPL code which has much more functionality. Any valid AGSPL program P with matched curly brackets is equivalent to the 2/9 of an esolang program:



Hello, World!

Takes 49 seconds to execute. Notice that first character, not a printable character though, is actually U+0088 in UTF-16 in order to satisfy the restriction of first character.


Here is a 35 seconds version.


You don't even have to wait.