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.
Turing Code
| Designed by | IamAfile |
|---|---|
| Appeared in | 2026 |
| Computational class | Unknown |
| Reference implementation | Unimplemented |
Preface
This is a Turing-machine-like language created by IamAfile.
It is Turing-complete because it is designed following the Turing machine model. Rather than "following", it is more accurate to say it is a near direct copy.
Grammar
Initialize
set tape [1,2,3,"HB"]
Set cells with positive indices (0~∞)
set tape -[1,2,3,"HB"]
Set cells with negative indices (-1~-∞)
set state A
Set the initial state
- Uninitialized cells default to 0
- The tape extends infinitely
- Escape character \ is allowed inside strings
- Read-write head starts at index 0
- Cells may store numbers and strings
Rule
- state{Rule1|Rule2...}
- read,write,move,new_state
| Field | Meaning |
|---|---|
| read | What symbol is read |
| write | What symbol to write |
| move | Direction to move (R = right, L = left, Z = ZeroMove) |
| new state | The new state to switch into |
- Multiple rules separated by vertical bar
Halt
Execution halts when there is no matching rule.
Execution also halts when jumping to an undefined state.
After halting, the full tape is printed, and leading and trailing zeros are stripped.
Rule Priority
Priority runs from left to right.
Items written further to the left have higher priority.
When two rules both match, the higher priority rule runs; the lower priority rule will never run.
Comment
# 我是注释 i'm Six Seven (*1 Line 二行 3 line)* #It can be used for drawing, which is super cool!!! ## ## ### ## ## ### ## ## ######## ### ######## ### ## ## ### ## ## ### ## ## ###
Identifier
State names must be valid identifiers.
An identifier may start with _, but cannot start with a digit.
Allowed identifier characters: a–z, A–Z, 0–9, _
Errors
- Characters appearing in invalid positions
- State name is not a valid identifier
- Unclosed parentheses
- Unclosed block comment
- String missing quotation mark / unclosed quote
- Whitespace between state and the opening curly brace
Example
- Binary counter (non-halting)
set tape [2]
set state A
A{0,1,R,Back|1,0,L,B|2,2,L,A}
B{1,0,L,B|0,1,R,Back}
Back{1,1,R,Back|0,0,R,Back|2,2,Z,A}
- Binary counter (halting)
set tape [2]
set tape -[3,0,0,0,0,0,2]
set state A
A{0,1,R,Back|1,0,L,B|2,2,L,A}
B{1,0,L,B|0,1,R,Back}
Back{1,1,R,Back|0,0,R,Back|2,2,Z,A}