Suxesol

From Esolang
Jump to navigation Jump to search

Suxesol is a program language invented by User:Zzo38. It is a bit influenced by BlooP.

The program consists of any number of blocks. The last one is the main program and the others are subroutines numbered in order starting from zero. Numbers on the stack and in cells are unbounded non-negative integers and infinity.

Commands:

0   Zero to stack
+   Successor of number
?   Infinity to stack
[   Begin block/loop
]   End block/loop
{   Begin comment
}   End comment
!   Store
@   Fetch
.   Output
*   Subroutine call
&   Leave block(s)

You can also use any numbers written in decimal to push that number to the stack.

The blocks inside of a subroutine block are loops, before starting it pop a number from stack to give maximum number of times to loop.

Subroutine call takes a number from stack which tells it which subroutine to call.

Store and Fetch are like Forth, accessing the variable storage of cells (each cell's address is a number).

The successor of infinity is infinity.

Leave block is nothing if number is zero, if larger than zero it breaks out of that many loops and/or subroutine calls.

Variations

These are variations that aren't the plain Suxesol program language but can be used in case you want these differences.

Name: If you want to have names for stuff, you can also have outside of a block a word consisting of uppercase letters and hyphens, and a number, and inside of a block writing that word corresponds to that number. If the name is followed immediately by a block defining a subroutine then it corresponds to the number of that subroutine.

Zero: In this variant you cannot write numbers other than zero directly (and spaces are not required), but infinity is now represented by a question mark.

Remember: A less-than sign pushes a state to the states stack (a separate stack from the numbers stack) and causes it to remember any changes to variable cells storage, a greater-than sign pops the state from the stack, causing all cells to be reverted back to how it was before (but the numbers stack is not reverted). These angle-brackets are just another kind of block, so they must nest correctly, and the leave block command can be used on it (the states will be popped as the blocks are left). In addition, a block defining a subroutine can use angle-brackets and you can omit the square-brackets around the entire subroutine-codes in this case for convenience.

String: You can put strings of text in quotation marks, which is represented as a number. The output does output as text.

Small-Suxesol: You cannot write numbers other than zero directly. Also, the Output command does not exist, subroutines do not exist, and comments do not exist (white-space is not allowed either). Infinity does not exist either. And, the main routine does not need to be inside of a subroutine block.

Examples

This is an example using Name/Remember:

PLUS<[+]>
TIMES<0!0 1![1@0@[+]1!]1@>
EQUALS<++0!++1!0 0@!1 1@!0@@>
LESS<1!0!3 2!0@+[1 2@!2@+2!]3 2!1@+[0 2@!2@+2!]0@+++@>
NOT<1 0!0 1!@>
AND<1!0 0!@>
OR<0!1 1!@>

From this program, you can see that it implements all of the functions of BlooP/FlooP.

This is fibonacci numbers program, using "Zero" variant:

[0+0!?[0@.0@0@0+@[+]0!0+!]]