Where is an esoteric programming language created by User:Ketok.
Where operates on 4 memory cells, initially set to 1, 2, 3, 4. Each cell can contain value ranging from 0 to 255.
WHERE condition action
Where statement executes action on all cells satisfying the given condition.
WHERE >2 SET 255
will set all memory cells with value higher than 2 to 255.
WHILE [ANY|ALL] condition ... END
While statement executes its contents while all/any cells satisfy the given condition.
Reset statement resets values of all cells to their initial state. It's mainly intended to be used in the interactive mode.
- SET value
- ADD value
- SUB value
Interactive mode is a feature added in v0.2.0 release used to run Where code interactively in the terminal. In other words it executes REPL (Read, Evaluate, Print Loop) for Where. It can be entered by running Where interpreter without any command line arguments.
# Truth machine WHERE =1 INPUT WHERE =0 OUTPUT WHILE ANY =1 WHERE =1 OUTPUT END
# A simple program that adds two numbers together WHERE >1 ADD 251 WHERE =1 INPUT WHERE <253 ADD 128 WHERE =253 INPUT WHERE >253 SET 0 WHILE ANY >128 WHERE >128 SUB 2 WHERE >0 ADD 1 END WHERE =0 SET 255 WHERE <128 OUTPUT
Interpreter for Where is written in F# with FParsec. It can be downloaded from github.