Pointing
What if pointers were the main show? Every variable is one, and an assignment always writes to an address.
Calculus is fun, 2025 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 10 known programs · Test method
Run it
The idea
Calculus is fun made Pointing in 2025, from an idea that came while learning C++ in 2023. Memory is a line of integers of any size. Address 0 is the read only zero, ROZ, which plays the null pointer, and writing there does nothing. Variables live below it, at -1, -2 and on, and each one holds a pointer.
Read the story
So acc is a pointer, @acc is where that pointer is kept, and $acc is the number it points at. An assignment a = b writes b at the address that a gives. A variable changes only that way, so moving a pointer means writing to its own address, @p = + p 1.
Expressions are in Polish notation, +*5,3,2 for 5 times 3 plus 2, so they need no brackets.
The machine
| Form | Does |
|---|---|
foo @foo $x | A pointer, its address, the memory at x |
+ - * / % _ | Arithmetic and negation |
== < > <= >= | Comparisons, true is -1 |
¬ ∧ ∨ ⊻ ~ & \| ^ | Boolean and bitwise, the binary ones skip what they need not read |
? c a b | a if c is true, else b |
@foo = e | Make or move a pointer |
a = b | Write b at address a |
if (c) {} else while (c) {} | Control, with break and continue |
function f(x) {} | A function, with return |
Built in are allocate, free, fread, inputInt, inputStr, outputInt and outputChar. A call puts each argument in a new cell and gives the function a pointer to it, so $x is the argument. [text] is a comment.
Example
The lesson in the three faces of a variable.
The lesson in the three faces of a variable. @acc is -1 because acc is the first variable, acc is 1 because that is where allocate found room, and $acc is the 3 written there.
The short circuit example. The three lines are the same logic, but ∨ and ∧ skip their second part when the first decides it, and each call prints its letter.
The specification also has a cat, a linked list, an RPN calculator and a brainfuck interpreter that keeps its tape as a linked list.
Patterns it teaches
- Hostile design: every change is a write to an address, even moving a pointer.
- Turing completeness: shown by the brainfuck interpreter.
Further
See also
Also in Hostile
Write your own in Run Convert a program from Pointing
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: pointing.
Command line
shib run pointing -e '@acc=allocate(1)
acc=3
outputInt(@acc) [-1 (it is the first variable)]
outputChar(44) [,]
outputInt(acc) [1 (where allocate found enough empty space)]
outputChar(44) [,]
outputInt($acc) [3 (from line 2)]'shib manual pointingSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/pointing.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org