Polytran

From Esolang
Jump to navigation Jump to search

Polytran is an esoteric programming language that is a mix between Polynomial and Fortran, made by Areallycoolusername. It was inspired by User: Xolroc who commented on the Polynomial talkpage, "Combine this with Fractran and you have a truly unusable mess." However, I don't think it would be possible to even mix the two as, polynomials don't allow division, and Fractran uses division. So Fortran was used instead.

Explanation

According to the Polynomial page, it's "designed in such a way that each program is simply a polynomial function, where all of the language statements are done by the zeroes of the function." Therefore, Polynomial programs are often very difficult to understand, due to the time-consuming nature of finding the zeroes of a function with high degree." It took a long time to even begin to understand what a polynomial was, but after searching online, it can be "easily" described as a function involving only non-negative powers of x, addition, subtraction, and multiplication. This means that a function with x to the power of -2 or division is invalid, as it has a negative exponent and includes division. On the other hand, a function like:

x to the power of 2 + 12xyx-2

Is perfectly fine, as it has addition, subtraction, and multiplication and a valid exponent. Now, the polynomial language statements, "are done by the zeroes of the function." Therefore, a program must be huge as the zeros in the program are the actual commands. All programs start with "f(x)=". Fortran is a language that is (arguably) easier to understand than Polynomial, and will be mixed with Polynomial in order to create Polytran. All programs in Fortran start with a program declaration, the pre-processor command "implicit none", and ends with the end declaration of a program. For instance:

program Helloworld
implicit none
! This prints "Hello, world!"
print *,'Hello, world!'
end program Helloworld

This program prints hello world to the screen. Its syntax is similar to Pascal. Now, we screw it up. In order for this language to become an "unusable mess", we have to mix unusual pre-processor commands, polynomial functions, and endless commas.

Programs

All Fortran code must start with the program declaration, implicit none, and end with the end declaration of the program as stated before. Similarly, Polynomial needs "F(X)=". So when we mix it up, we get:

01000001 01101100 01101100 00100000 01100011 01101111 01101101 01101101 01100101 01101110 01110100 01110011 00100000 01100001 01110010 01100101 00100000 01101001 01101110 00100000 01100010 01101001 01101110 01100001 01110010 01111001 00101110 00100000 01010000 01110010 01101111 01100111 01110010 01100001 01101101 00100000 01101110 01100001 01101101 01100101 01110011 00100000 01101000 01100001 01110110 01100101 00100000 01110100 01101111 00100000 01100010 01100101 00100000 01110110 01100001 01101100 01101001 01100100 00100000 01110000 01101111 01101100 01111001 01101110 01101111 01101101 01101001 01100001 01101100 00100000 01100110 01110101 01101110 01100011 01110100 01101001 01101111 01101110 01110011 00101110 00100000
programf(x) = 2xy + x2 - 3
f(x)poly all
(statements)
endprogramf(x) = 3 - x6 + 1

All Polytran programs start with "programf(x) = ", followed by a polynomial function, the implicit none is replaced by "f(x)poly all)", and the "end program" in Fortran is replaced by "endprogramf(x) = " followed by a different function you used to start the program. Comments are now made in binary, and the comment is this example program says, "All comments are in binary. Program names have to be valid polynomial functions." Now, as for statements, Polynomial uses the form, "f(x) = 3x^2 + x + 7", where the mononomials are in order from highest to lowest degree,and the final term can omit x^0, to allow for the constant. In order to output something in Fortran, you have to use, "print *,". Now, we can't have all the commands in Polytran have words in them, so this will have to involve numbers.

Code Examples

Hello World

programf(x) = 9 + x5 - 21
f(x) poly all
7179921164468879651662866454307976481821361700x^29 + 20633888636784455204085657939750648669099906931549131855360060x^28
endprogramf(x) = 5 - 69 + x3

Implementations

I don't think its worthwhile to make an interpreter/compiler for this language. However, if you have an implementation, feel free to put it here.