Polydeuces
- The title of this article is also called Πολυδεύκοι.
- The title of this article is also called Brainfuck 2.1.
Polydeuces is a programming language designed by PSTF. It have only one dialect, Castor.
Inspiration of the name of this language and dialect
In Greek mythology, Polydeuces, along with his twin brother Castor, became the two stars of the Gemini constellation. Polydeuces was given immortality by Zeus and persuaded Zeus to share the gift with Castor (so Polydeuces and Castor had to set aside half of their time in Hell and the other half in Olympus).
According to this, I designed Polydeuces Programming Language, which will be safe and strong, while Castor dialect is weaker. Both languages are Turing-complete.
Instruction table
With all that "nonsense" said, it's time to say something useful. This thing was inspired by Brainfuck and Befunge.
All commands work on a 32-bit(unshackled if in Polydeuces++), 30,000-lengthed tape, a stack, and a counter.
Commands with asterisk only work in Polydeuces.
Basics
Instruction | Meaning |
---|---|
< |
Moves the pointer one cell to the left. |
> |
Moves the pointer one cell to the right. |
+ |
Adds 1 to the pointed cell. |
- |
Subtracts 1 to the pointed cell. |
. |
Prints the pointed cell as a character. |
, |
Reads a character from input and stores it into the current cell. |
[ |
If the current cell data is 0, jump to the corresponding closing bracket. |
] |
If the current cell data isN'T 0, jump to the corresponding opening bracket. |
{ |
Pushes the pointed cell's value to the stack. |
} |
Pops from the stack into the current cell. |
* |
Doubles the pointed cell's value. |
` |
Halves the pointed cell's value. |
~ |
Bitwise NOTs the pointed cell's value. |
^ |
Squares the pointed cell's value. |
@ |
Break out of loop. |
! |
Loop continue. |
? |
Set the pointed cell to a random 32-bit value. |
#00000000 - #FFFFFFFF |
Sets the pointed cell to a byte, written in hexadecimal. |
( |
If the current cell data is 0, jump to the corresponding closing parenthese. |
) |
Do nothing, just end of if-statement. |
« * |
Push the current cell to counter. |
» * |
Pull the value from counter to the current cell. |
' |
Sets the pointed cell to the value of the next character. |
" * |
String mode. Set the pointed cell to the value of each character, then move right. |
_ |
Unary minus. Set pointed cell to (256-last pointed cell value)%256. |
:foo: * |
Define a function. Its name is between the colons. |
$ * |
End function definition. |
;foo; * |
Run a function. Its name is between the semicolons. |
/ |
Loop modifier. Checks if pointed cell is positive (as a signed value) instead of nonzero. |
\ |
Loop modifier. Checks if pointed cell is negative (as a signed value) instead of nonzero. |
¶ * |
Loop modifier. Checks if pointed cell is same as counter instead of nonzero. |
0 * |
Loop modifier. Checks if pointed cell IS zero instead of nonzero. |
q * |
Print the program's source code. |
Advanced
Instruction | What it does |
---|---|
+00000000 - +FFFFFFFF |
Add a value to the pointed cell. |
-00000000 - -FFFFFFFF |
Subtract a value from the pointed cell. |
*00000000 - *FFFFFFFF |
Multiply. |
`00000001 - `FFFFFFFF |
Integer division. |
^00000000 - ^FFFFFFFF * |
Exponentiate. |
%00000001 - %FFFFFFFF |
Modulo. |
&00000000 - &FFFFFFFF |
Bitwise AND. |
|00000000 - |FFFFFFFF |
Bitwise OR. |
X00000000 - XFFFFFFFF |
Bitwise XOR. |
O |
Print the pointed cell's value as eight hexadecimal digits. |
I |
Input eight hexadecimal digits into the pointed cell's value. |
More advanced
Instruction | What it does |
---|---|
d |
Change everything to decimal(arbitary length). |
b |
Change everything to binary. |
o |
Change everything to octal. |
h |
Change everything to hexadecimal back again. |
s * |
Change everything to base 64. |
T * |
Change everything to 8-bit. |
M * |
Change everything to 16-bit. |
L * |
Change everything to 64-bit. |
= * |
Change everything to 32-bit. |
¤ * |
Change everything to Unshackled. |
S |
Return and discard stack top value. |
Examples
Add by yourself, I'm too lazy to write them.
Computational Class
It is Turing-complete, since it is Brainfuck derivative.