99 bottles of pain
99 bottles of pain is an esoteric programming language by User:BoundedBeans with the syntax based around the output of a common programming problem.
To start, each verse of the song is given a number. It must go down by 1 every verse, but it may start at any number, not just 99, and it may also end at any number, not just 1. A blank line is also required between verses, and will not be interpreted as a subroutine.
Each verse in the song goes like this:
(verse number) bottles of b(x1)r on the wall (verse number) bottles of b(x2)r Take (x3) down Pass it around (verse number) bottles of b(x4)r (operator) on the wall.
So we have 5 arguments to each verse: x1, x2, x3, x4, operator. All operators are quadary, a.k.a. they accept 4 arguments always.
x1, x2, and x4 have a binary sequence assigned to them, while x3 has a decimal representation of the integer. Note that the binary sequence should always begin with 1, and the decimal should follow this rule as well. x1, x2, x3, and x4 are not direct numbers, but instead each index a variable (multiple can refer to the same variable in a verse). Operations are performed between these variables based on the word before " on the wall". The result is always stored in x4, except for "set" which also stores a result in x2, and "put" which stores a value in all of its arguments.
e - 0 E - 1
Operators
Put these operators before " on the wall".
"put": Declare the 4 values and initialize them all as 1. If they already exist, throw an error. "placed": Add the 4 values together and store the result in x4. "sitting": Do (x1 - x2) - (x3 - x4), store the result in x4. "laying": Multiply the 4 values together and store the result in x4. "lying": Do (x1 / x2) / (x3 / x4), store the result in x4. "unnoticed": Do (x1 % x2) - (x3 * x4), store the result in x4 "set": Set x2 to x1, set x4 to x3 nothing: no-op, but can still check x4 for a loop.
But there are some extra things allowing even more functionality.
The first is that the "Pass" in "Pass it around" can contain an extra 's'. This causes it to print x4 as an ascii value if negative, and as a number if positive. To print negative numbers, just print a hyphen first.
The second is that the "Take" in "Take one down" can have a lowercase 't'. This causes it to accept input into x3 before performing the calculation, and keeping this value in x3 after it's done.
Finally, while loops can be implemented by adding a space before some verses. Whatever verse is directly above the indented code will run that code if and only if x4 is greater than 0 after the calculation, and will loop as long as x4 continues to be greater than 0. Also, these can be nested, by including more spaces, and they also have a separate verse number, so make sure to remember to not skip numbers outside of it, or the code will break. Note that current x4 does not stay checking for 0, the one checked for 0 is the x4 of the last statement in the loop.
Hello world: (I suspect I may have made a mistake somewhere here, but this was painful to write and I don't want to check it for errors)
99 bottles of bEr on the wall 99 bottles of bEer Take 3 down Pass it around 99 bottles of bEeer put on the wall 98 bottles of bEeEr on the wall 98 bottles of bEEer Take 7 down Pass it around 98 bottles of bEeeer put on the wall 97 bottles of bEr on the wall 97 bottles of bEer Take 3 down Pass it around 97 bottles of bEeer sitting on the wall //now 100 is 0 96 bottles of bEeer on the wall 96 bottles of bEeer Take 1 down Pass it around 96 bottles of bEer placed on the wall //now 10 is 2 95 bottles of bEer on the wall 95 bottles of bEeer Take 4 down Pass it around 95 bottles of bEeEr placed on the wall //Now 101 is 3 99 bottles of bEeEr on the wall 99 bottles of bEEer Take 1 down Pass it around 99 bottles of bEr set on the wall //here I copy my 3 to 110 //luckily for me, there's a pretty easy way to add things to the code without changing all numbers below, as long as we know that x4 is positive, which for verse 95 of main, //is guaranteed to be 3. So now I have saved the 3 //now we just need to set it to 0 98 bottles of bEEEr on the wall 98 bottles of bEEEr Take 7 down Pass it around 98 bottles of bEEEr sitting on the wall 94 bottles of bEer on the wall 94 bottles of bEer Take 5 down Pass it around 94 bottles of bEeEr laying on the wall //now 101 is 72 93 bottles of bEeer on the wall 93 bottles of bEeeer Take 1 down Pass it around 93 bottles of bEr set on the wall //we've duplicated our zero, now we can overwrite it safely, set 1 to 1 which does nothing 92 bottles of bEeer on the wall 92 bottles of bEeer Take 5 down Passs it around 92 bottles of bEeer sitting on the wall //now 100 is -72, print 91 bottles of bEEer on the wall 91 bottles of bEeEr Take 1 down Pass it around 91 bottles of bEr set on the wall //now we have our 3 back in the original place, so we can safely overwrite it again 90 bottles of bEeer on the wall 90 bottles of bEeeer Take 8 down Passs it around 90 bottles of bEEer placed on the wall //adding -72 and 3 gets -69, which is E 89 bottles of bEeeEr on the wall 89 bottles of bEeEer Take 11 down Pass it around 89 bottles of bEEeer put on the wall //it's racking my brain a bit with too small amounts of variables, so I'm making more 88 bottles of bEer on the wall 88 bottles of bEeeEr Take 1 down Pass it around 88 bottles of bEr set on the wall //duplicate the 2 87 bottles of bEeeEr on the wall 87 bottles of bEeeer Take 8 down Pass it around 87 bottles of bEeeEr placed on the wall //get a 4 86 bottles of bEeeer on the wall 86 bottles of bEeEer Take 1 down Pass it around 86 bottles of bEr set on the wall //duplicate the zero again 85 bottles of bEeer on the wall 85 bottles of bEeeEr Take 10 down Passs it around 85 bottles of bEeEer sitting on the wall //subtract -72 - 4 to get -76, print out L 84 bottles of bEeer on the wall 84 bottles of bEeeEr Take 10 down Passs it around 84 bottles of bEeEer sitting on the wall //print L again 83 bottles of bEeEer on the wall 83 bottles of bEEer Take 1 down Pass it around 83 bottles of bEr set on the wall //set 110 to 1010, since we'll use L later 82 bottles of bEEer on the wall 82 bottles of bEeEr Take 7 down Passs it around 82 bottles of bEEEr sitting on the wall 81 bottles of bEEEr on the wall 81 bottles of bEEr Take 1 down Pass it around 81 bottles of bEr set on the wall //set 11 to 111 since we'll need O later //now we need to make 44. This will be interesting 80 bottles of bEEeEr on the wall 80 bottles of bEEEer Take 15 down Pass it around 80 bottles of bEeeeer put on the wall //I'm creating more variables to help with getting the 44 79 bottles of bEeEr on the wall 79 bottles of bEeEEr Take 1 down Pass it around 79 bottles of bEr set on the wall //duplicate the 3 78 bottles of bEer on the wall 78 bottles of bEeeer Take 8 down Pass it around 78 bottles of bEeEEr placed on the wall //make 5 77 bottles of bEer on the wall 77 bottles of bEer Take 11 down Pass it around 77 bottles of bEEeer laying on the wall //make 10 76 bottles of bEeeer on the wall 76 bottles of bEeeer Take 12 down Pass it around 76 bottles of bEEeEr placed on the wall //make 11 75 bottles of bEer on the wall 75 bottles of bEer Take 13 down Pass it around 75 bottles of bEEEer laying on the wall //make 44 74 bottles of bEeeer on the wall 74 bottles of bEeeEr Take 1 down Pass it around 74 bottles of bEr set on the wall //duplicate the 0 73 bottles of bEeeEr on the wall 73 bottles of bEEEer Take 9 down Passs it around 73 bottles of bEeeEr sitting on the wall //make -44, print 72 bottles of bEeeer on the wall 72 bottles of bEeeer Take 13 down Pass it around 72 bottles of bEEEEr placed on the wall //make 12 71 bottles of bEeeer on the wall 71 bottles of bEeeer Take 14 down Passs it around 71 bottles of bEEEEr placed on the wall //make -32, print 70 bottles of bEr on the wall 70 bottles of bEEEer Take 1 down Pass it around 70 bottles of bEEEEr set on the wall //clear up some of the variables 69 bottles of bEer on the wall 69 bottles of bEEr Take 1 down Pass it around 69 bottles of bEr set on the wall //duplicate the 2 68 bottles of bEEr on the wall 68 bottles of bEEr Take 1 down Pass it around 68 bottles bEEr laying on the wall //make 8 67 bottles of bEeeer on the wall 67 bottles of bEeeEr Take 1 down Pass it around 67 bottles of bEr set on the wall //duplicate the 0 66 bottles of bEEEr on the wall 66 bottles of bEEr Take 9 down Passs it around 66 bottles of bEeeEr sitting on the wall //make -87, print 65 bottles of bEeeer on the wall 65 bottles of bEeeer Take 8 down Passs it around 65 bottles of bEEEr placed on the wall //print O again by adding 0 to it 64 bottles of bEeeer on the wall 64 bottles of bEeeEr Take 1 down Pass it around 64 bottles of bEr set on the wall //duplicate the 0 63 bottles of bEEEr on the wall 63 bottles of bEeEr Take 9 down Passs it around 63 bottles of bEeeEr sitting on the wall //make -82, print 62 bottles of bEeeer on the wall 62 bottles of bEeeer Take 8 down Passs it around 62 bottles of bEeEer placed on the wall //print L again 61 bottles of bEeer on the wall 61 bottles of bEeeer Take 2 down Passs it around 61 bottles of bEer placed on the wall
(Supposed to print in all caps with a comma and no exclamation point ("HELLO, WORLD") but I think I may have made a mistake early on which would affect everything afterwards)