pointer-ng

From Esolang
Jump to navigation Jump to search

pointer-ng is an extended version of Brainfuck by Maximilian Krause (aka fucketh1cs) who also wrote an interpreter for it. pointer-ng is a superset of Brainfuck, therefore every Brainfuck code is valid in pointer-ng as well. However, pointer-ng offers several more features which make coding in Brainfuck a little easier. The added features contain for example networking, IO and randomness.

pointer-ng Commands

Symbol Feature
<>+-.,[] Brainfuck equivalent.
| Opens or closes a comment. Spaces however are not permitted within a comment. Use underscores _ instead.
~ Switches [dir] from home directory to script startup path or the other way for the commands accessing the IO filesystem.
# Reads [dir]/input.ptng and puts all the content in the cells to the right. The pointer is set to the end.
$ Appends the content of the current cell into [dir]/output.ptng.
v Downloads the content from the URL in [dir]/inurl.ptng and writes all the content in the cells to the right. The pointer is set to the end.
^ Sends a POST header with the content output:[current cell value] to the URL in [dir]/outurl.ptng.
* Performs the operation [right cell]=[current cell]*[left cell].
/ Performs the operation [right cell]=[current cell]/[left cell].
" Performs the operation [right cell]=[current cell]+[left cell].
' Performs the operation [right cell]=[current cell]-[left cell].
% Performs the operation [right cell]=[current cell] mod [left cell].
! Performs the operation [right cell]=[current cell]*10.
? Performs the operation [right cell]=floor([current cell]/10).
& Zeroes the current cell.
@ Puts a random number between (incl.) 0 and (incl.) 10 into the current cell.
_ Performs the operation [current cell]=-1*[current cell].
: Prints the content of the current cell as an integer.

Example Code

Calculate (5+5)*10 and output the result:
+++++>+++++">!>:

Take two inputs and print the sum (up to 127):
+++++++++++!>.&<&+:&+++++!>++++++++.&<&+++!>++.&<&;>+++++++++++!>.&<&++:&+++++!>++++++++.&<&+++!>++.&<&;>+++++++++++!>++++.&<&+++++!>++++++++.&<&+++!>++.&<&<">:

Interpreters

Official interpreter (Java needed)
Download: https://www.dropbox.com/s/hcm80qvwcw59m5q/pointer-ng.jar?dl=0
Source: https://github.com/fucketh1cs/pointer-ng
Usage: java -jar pointer-ng.jar [*.ptng script]