Pathana
Pathana is a programming language which is based on Malbolge.
Name
In the Manu Smriti, there are 21 levels of hell mentioned, the 17th of which is called Pathana. This name is a reference to the fact that, rather than bits or trits, Pathana operates on 17-values, hereby referred to as suboptimits.
Data Structures
The suboptimit-based values will hereby be represented with the following convention: numbers in code like this
, with 0-9
for values 0 through 9, and a-g
for decimal values 10 through 16. However, because I know how annoying it is to try and parse something like the 3-suboptimit value d0g
as the decimal number 3773, I will only use suboptimits where it is better suited for understanding or necessary in the code, and I will try to use decimal values (which aren't in code) alongside them unless it would fundamentally change something.
Pathana operates on an array of 100000000000000000
cells (17 ^ 17 = 827240261886336764177, around 800 quintillion). Each 17-suboptimit cell of the array can contain a value from 00000000000000000
to ggggggggggggggggg
(827240261886336764176).
Structure
Like Malbolge, it has a data pointer and a code pointer.
A Pathana program starts with the code pointer and data pointer at cell 0, the first cell. That cell contains a value x. After the value is read and the code is done, the code pointer and data pointer are at positions c and d respectively. The code pointer then advances by going to the cell represented by:
(ggggggggggggggggg
- c - x) modulo 100000000000000000
(in decimal, (827240261886336764176 - c - x) modulo 827240261886336764177)
Meanwhile, the data pointer advances by going to the cell represented by:
(ggggggggggggggggg
- c + x) modulo 100000000000000000
(in decimal, (827240261886336764176 - c + x) modulo 827240261886336764177)
Instruction Opcodes
These are some opcodes which are used for instructions. Check back later if you want!
o: output
Basic Code
Because Pathana's array is so long, and the code pointer jumps all over the array, it is too impractical to write the entire program in a single line like Malbolge. Therefore, Pathana code is written in such a way that each indent can describe a separate part of the code.
Before each line of code, a 17-suboptimit value representing the starting position of the code is given. This has to be 17 suboptimits exactly. After this, the actual code will start until the next newline. To be clear, I understand that the definition of a "newline" can vary, and this is why a newline is defined by the newline-type value that ends the file (because you're supposed to end files with newlines) This also means that Pathana code can contain all but one kind of newline as a code value when originally written, with the one excluded newline being the one that ends the file.
The first character of the actual code will be added to the cell represented by the 17-suboptimit value. The next character will be stored in the next cell, and so on until the newline.
If two lines of code overlap, like if both of them start with 00000000000000000
, the values in each line are both added to the cell. The value in the cell underflows if it exceeds ggggggggggggggggg
. Similarly, the value of the position corresponding to the character in the code underflows if the position exceeds ggggggggggggggggg
.
Here is an example, with comments in parentheses:
00000000000000000X (the value X is stored in position 0) 00000000000000000Y (the value Y is added to position 0) gggggggggggggggggZA (the value Z is added to the last position in the array and the value A is added to position 0)
If there is no code following the 17-suboptimit value, it is taken as how many times to run the following line. For example:
00000000000000005 (note that no code is following this 17-suboptimit value) 00000000000000000Y (the value Y is added to position 0, and it is added 5 times)
This makes it somewhat easier to add very large values to the array.
Turing-Complete
Even though Pathana's array is extremely large, it is not Turing-complete because the size of the array is finite. That said, it is entirely possible that this language can interpret Brainfuck.
Implementation
There is no implementation yet, partially because the language is not finished.
If anyone does try to implement this, I suggest using key-value pairs instead of an array to implement the Pathana array. That way, you don't have to hold nearly one sextillion values in memory.