We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Pointer Calculus

From Esolang
Jump to navigation Jump to search

Pointer Calculus is an esoteric programming language created by User:Mutasimos in 2026. In this language, the only datatype the programmer can use is a pointer.

Memory

Pointer Calculus' memory is one big array of pointers and a collection of variables that bind to a memory cell. The first memory cell is never used as it is null.

The Language

Expressions
Code Meaning
. The null pointer
ident The pointer contained by the variable named "ident"
&expr Reference the given expression
*expr Dereference the given expression, returning the value inside. If the expression evaluates to a null pointer, throw an error
[expr] Perform a deep copy of the given expression, also copying the cycles instead of getting stuck in an infinite loop
Comparisons
Code Meaning
=== Check if the pointer directly equals another pointer
!== Not "==="
== Walk the pointer chain and check if the pointer depth of one operand is the same as the other operand's. This also recognizes cycles, and checks if the cycles are equal
!= Not "=="
Statements
Code Meaning
let ident; Define a new variable "ident" and bind it to null
let ident = expr; Define a new variable "ident" and bind it to the given expression
l-value = expr; Assign the given l-value to the given expression
loop expr { stmts } Loop while the expression is not null (short for "loop expr !== . { stmts }")
loop expr compar expr { stmts } Loop while the condition is true
in l-value; Input character and set l-value to a Peano numeral-style pointer chain until null where the number is the Unicode codepoint of the character. If EOF, return null
out expr; Interpret expression as a Peano numeral-style pointer chain (if it has a cycle just print ∞) and print the number as a character according to Unicode

There is a quality-of-life feature where you can specify a number after & or * for how many references / dereferences you want to do. An l-value can only be an identifier or a dereference of another l-value. Anything after "#" on a line is considered a comment. Shadowing a variable is not allowed, so be creative with your names! Each execution of a loop body constitutes a fresh scope; variables declared with let inside a loop body are freed at the end of each iteration and may be redeclared on the next.

Examples

Hello, world

out &72.;
out &101.;
out &108.;
out &108.;
out &111.;
out &44.;
out &32.;
out &87.;
out &111.;
out &114.;
out &108.;
out &100.;
out &33.;

truth-machine

let input;
in input;
out input;
loop *48input {
    out input;
}