PIGS
Paradigm(s) | imperative |
---|---|
Designed by | User:Yousurname |
Appeared in | 2022 |
Dimensions | one-dimensional |
Computational class | Turing complete |
Major implementations | GitHub repository Online interpreter |
File extension(s) | .pigs |
PIGS is a minimalistic esoteric programming language that is based around pointers, made by User:Yousurname. Its name originates from the four main commands in it: P
, I
, G
, and S
.
Language overview
In PIGS, data is stored in variables that can be referenced through pointers. Variables are numbers that can be from 0 to 4294967295 (unsigned 32-bit). Each of the commands, except for #
, is pointer-based. Each command takes a parameter in binary (0
s and 1
s) that directly follows the command symbol.
Command descriptions are taken from the GitHub repository.
Command | Description |
---|---|
P |
Prints the corresponding character of the variable that the parameter points to. If this is impossible, then it prints nothing. |
I |
Takes input starting with the variable that the parameter points to. The corresponding number of each character is stored. |
G |
Starts running from a specific index (0-indexed) of the commands, specified by the variable that the parameter points to. If the index goes past the end of the code, then the program is terminated. |
S |
Prepares to set the variable that the variable that the parameter points to, points to. By default this is 0. |
+ |
Adds the variable that the parameter points to to the prepared variable. |
- |
Subtracts the variable that the parameter points to from the prepared variable. |
= |
Sets the prepared variable to 1 if it is equal to the variable that the parameter points to, otherwise 0. |
: |
Sets the prepared variable to the variable that the variable that the parameter points to, points to. |
# |
Sets the variable to the parameter. |
The P
and I
commands use Unicode. All characters besides those described above are treated as comments. Because of how the language is designed and how it filters out anything that is not recognized as a command with a parameter, it is impossible to run into errors.
Examples
Examples are taken from the GitHub repository.
- Hello, world!:
#1001000P0#1100101P0#1101100P0P0#1101111P0#101100P0#100000P0#1110111P0#1101111P0#1110010P0#1101100P0#1100100P0#100001P0
- Truth-machine:
#1S0#10S1#11110S0#11S1#11100S0#100S1#110001S0#101S1#10S0#110I1S0#111S1#0+110=100+101:111P110G111
- Infinite loop:
G0
- Cat program:
#1S0#10S1#1000S0#101S1#11110S0+0S1#100101S0+0S1#10010I10S0#11S1:10=100+0+0+0+0+0:11G11:10P11S0#10S1+0G111
- Scream very loudly:
#1000001P0G1
Computational class
Although there have been no proofs on PIGS's computational class yet, it is largely believed to be Turing complete as long as number values are unbounded because it can handle conditional branching and has the ability to change an arbitrary amount of memory.
It is thought to be that only the characters GS:1
, +
or -
, and =
or #
are needed for Turing-completeness.