Pointstack
Jump to navigation
Jump to search
- This article is not detailed enough and needs to be expanded. Please help us by adding some more information.
Pointstack is an esoteric programming language created by User:catto.4 in 2024. It is similar to brainfuck, except that it uses a stack instead of a tape. Items on the stack can only contain numbers.
Commands
Symbol | Explanation |
---|---|
! |
Pushes a 0 to the top of the stack. |
^ |
Increments the top value on the stack. |
_ |
Decrements the top value on the stack. |
+ |
Adds the top two values on the stack and pushes the result. |
- |
Subtracts the top two values on the stack and pushes the result. |
* |
Multiplies the top two values on the stack and pushes the result. |
/ |
Divides the top two values on the stack and pushes the result. |
. |
Pops the top value on the stack and prints it. |
, |
Takes one byte of input as an ASCII character and pushes it to the top of the stack. |
: |
Duplicates the top value on the stack. |
$ |
Swaps the top two values on the stack. |
? |
Pops and discards the top value on the stack. |
[ |
Marks the start of a loop. |
] |
If the top value on the stack is a 0, continue. Otherwise, jump back to the matching [ .
|
= |
If the top two values on the stack are equal, discard those values and push a 1. Else, push a 0. |
~ |
If the top two values on the stack are not equal, discard those values and push a 1. Else, push a 0. |
` |
If the top value on the stack is a 0, then skip the next command. |
\ |
If the top value on the stack is a 1, then skip the next command. |
Examples
Hello World
Outputs "Hello World".
!^^^^^^^^!^^^^^^^^^*. !^^^^^^^^^^!^^^^^^^^^^*^. !^^^^^^^^^!^^^^^^^^^^^^*:.. !^^^^^^^^^^^!^^^^^^^^^^*^. !^^^^^^^^!^^^^*. !^^^^^^^^!^^^^^^^^^^^*_. !^^^^^^^^^^^!^^^^^^^^^^*^. !^^^^^^^!^^^^^^^^^^^^^^^^*^^. !^^^^^^^^^!^^^^^^^^^^^^*. !^^^^^^^^^^!^^^^^^^^^^*.
Cat program
Takes one character and outputs it.
,.
Computational class
Pointstack's computational class is currently unknown.
Interpreter
_windowsbuilder on Discord has written a C++ interpreter for Pointstack:
#include <stdio.h> #define S 10000 void main(int a, char *b[]) {if (a < 2) return;int s[S]={0},p=-1,l[S],q=-1;char *c=b[1];while(*c){switch(*c){case'!':if(p+1<S)s[++p]=0;break;case'^':if(p>=0)s[p]++;break;case'_':if(p>=0)s[p]--;break;case'+':if(p>=1)s[p-1]+=s[p],p--;break;case'-':if(p>=1)s[p-1]-=s[p],p--;break;case'*':if(p>=1)s[p-1]*=s[p],p--;break;case'/':if(p>=1&&s[p])s[p-1]/=s[p],p--;break;case'.':if(p>=0)putchar(s[p]);break;case',':if(p+1<S)s[++p]=getchar();break;case':':if(p>=0&&p+1<S)s[p+1]=s[p],p++;break;case'$':if(p>=1){int t=s[p];s[p]=s[p-1];s[p-1]=t;}break;case'?':if(p>=0)p--;break;case'[':if(p>=0&&!s[p]){int r=1;while(r){c++;if(*c=='[')r++;if(*c==']')r--;}}else l[++q]=c-b[1];break;case']':if(p>=0&&s[p])c=b[1]+l[q];else q--;break;case'=':if(p>=1)s[p-1]=(s[p-1]==s[p])?1:0,p--;break;case'~':if(p>=1)s[p-1]=(s[p-1]!=s[p])?1:0,p--;break;case'`':if(p>=0&&!s[p])c++;break;case'\\':if(p>=0&&s[p])c++;break;}c++;}}