TuringLang
TuringLang is an esoteric programming language inspired by the Turing Machine created by User:AGO061. It uses a modern syntax to simulate Turing Machine behavior, making it compact yet challenging to read and interpret.
It provides features for tape manipulation, head positioning and state transitions with a customizable alphabet.
The original reference for the language can be found here
Core Concepts
The Tape
The tape is a sequence of cells storing symbols from an alphabet (default: 0 and 1).
- The tape is initialized with the TAPE command.
- Users can modify its contents with additional commands like CUT and ELONGATE.
The Head
The head interacts with the tape by:
- Reading a cell's value.
- Writing to a cell.
- Moving left, right, or staying in place.
The head's starting position can be explicitly set.
The States
The states define the machine's behavior. For each symbol on the tape:
- The machine checks the symbol.
- Performs an action (write/move).
- Transitions to the next state or halts.
There are 2 important rules for states:
- There must be one and only one
H
state (HALT). - There must be one and only one initial state.
TuringLang Commands
Tape and Alphabet Initialization
ALPHABET [<SYMBOL0><SYMBOL1><SYMBOL2>...]
Set a custom alphabet for the tape.TAPE [<SYMBOL0><SYMBOL1><SYMBOL2>...]
Initialize the tape with the specified symbols.
Head Positioning
HEAD <N>
Set the head position to the Nth cell (0-indexed).HEAD ^
Align the head visually using the ^ symbol.
State Definitions
<STATENAME> <CHECK><WRITE><MOVE><NEXTSTATE>... <INITIAL?>
Define states for the machine's operation.
Machine Execution
RUN
Execute the machine until a halt state or error occurs.
Tape Manipulation
CUT START END
Remove the tape contents between indices START and END (exclusive).CUT <CHARACTER>
Remove the specified CHARACTER from the sides of the tape.ELONGATE [R/L] <CHARACTER> <LENGTH>
Add CHARACTER symbols to the left (L) or right (R) of the tape.
Other Commands
WIPE
Clear all states in the machine.READ
Output the current contents of the tape.#
Add comments in your code.
Interpreters
Python (Original)
The Python TuringLang interpreter is the original interpreter for TuringLang, developed alongside the language by User: AGO061.
Additional Notes
Possible Changes
Unfortunately TuringLang is still in its early days (First release: Dec 15, 2024) which means there might be changes to the machine and tape functions (the core logic of the machine is already as it should be, so there's no need to change it currently). The Original Python interpreter will remain up-to-date with the possible new changes.