Pointy
Every operand may be a pointer, and a pointer may point at a pointer.
Ihope127, 2006 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
Ihope127 made Pointy in 2006. It is a counter machine with six instructions, and its one idea is the star. A number stands for itself, and a star in front of it reads memory at that location. So *1 is the value at location 1, and **1 is the value at the location that location 1 holds. There is no null pointer, location 0 is a location like any other, so a star never fails.
Read the story
The specification shows Pointy Turing complete twice, by a Minsky machine and by a table that turns brainfuck into Pointy.
The machine
| Instruction | Does |
|---|---|
CPY x y | Store the value x at location y |
INC x | Add 1 at location x |
DEC x foo | Take 1 from location x, or jump to LBL foo if it holds 0 |
LBL foo | Mark a place to jump to |
OUT x | Write x as a character |
INP x | Read a character into location x |
Every location starts at 0, and ; starts a comment. The only jump is the one in DEC, so a jump that always happens is a DEC on a location that stays 0. The specification leaves open what INP does when the input is used up; it ends the run, and that is how the cat stops.
Example
Location 1 holds 7, so CPY 72 *1 stores 72 at location 7 and INC *1 makes it 73, an I.
Location 1 holds 7, so CPY 72 *1 stores 72 at location 7 and INC *1 makes it 73, an I. Both *7 and **1 read it.
A loop counts location 1 down from 5. DEC 2 loop always jumps, as location 2 stays 0.
The Hello, World! keeps l at location 1 and o at location 2. It writes 119, a small w.
The cat.
Patterns it teaches
- Counter machines: increment, and decrement or jump on zero.
- Turing tarpit: six instructions, and brainfuck translates into them.
Further
See also
Also in Turing tarpits
Write your own in Run Convert a program from Pointy
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: pointy.
Command line
shib run pointy -e 'LBL start
INP 0
OUT *0
DEC 1 start ; the value at 1 will be 0, so this jumps to start' --input 'cat'shib manual pointySource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/pointy.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org