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.
I/M Machine
I/M Machine is an esolang invented by User:TBPO, inspired by InterpretMe.
| Paradigm(s) | imperative, OISC |
|---|---|
| Designed by | User:TenBillionPlusOne |
| Appeared in | 2025 |
| Memory system | Accumulator-based |
| Computational class | total/Unknown |
| Major implementations | below |
| Influenced by | InterpretMe |
Overview
The only memory I/M Machine uses is an accumulator, which is initially set to 1. The program consists of natural numbers of natural numbers separated by whitespace. All other instructions which include characters other than iImM are ignored.
The command described below is called until the program halts:
- The first number of the program is removed;
- [removed number - 1] is added to the accumulator;
- If accumulator is equal to 0, the program halts.
It can be seen as one instruction, which takes one argument a and executes the following pseudocode:
x+=a; if(--x==0) halt;
So I/M Machine can be analyzed as OISC.
I/M Machine can also be analyzed as a minimalistic language with two instructions:
I- Increment accumulator by 1.M- Decrement accumulator. If it's equal to 0, halt.
Dialects and computational class
There are two dialects of I/M Machine (classified by capabilities, not format):
- Finite I/M Machine is the more limited version of I/M machine. All programs have finite size in it, and all instructions after the last are 0s. It's total and unusable for programming.
- Periodic I/M Machine is a version of I/M Machine, in which programs are split into two finite parts: initial, which is executed once, and looping, which is executed infinitely. Parts are split with instruction |. Periodic I/M Machine is proved sub-Turing-complete in the talk page and it may be a Push-down automaton.
Relationship to InterpretMe
InterpretMe is a programming language that has one instruction:
*
|
Accept input and interpret it as InterpretMe code |
Practically it means that at each * instruction the amount of remaining user inputs is increased by amount of * in the input minus 1. That count can be tracked using either recursion or an accumulator.
Now suppose that each of these inputs is read from a file loaded before the execution, instead of the console (or other runtime I/O). That's basically what I/M Machine is, just in a different format.
- There's a page on that concept called atemlanguage, but it's deprecated and not recommended.
Example programs
Truth machine
? | 1
Replace ? with a number. If it's 0, accumulator will be set to 0 and the program will halt. If not, it will run forever (word "loop" isn't appropriate here), with accumulator at a constant value ?. Note that 1 (IM) is a NOP.
Implementation
Periodic I/M Machine as OISC in Python:
# PERIODIC I/M Machine Interpreter
def interpret(program):
'Interprets FIMM program'
global acc
for cmd in program:
try: int(cmd); cmd < 0
except: continue
if cmd != int(cmd) or cmd < 0: continue
acc += cmd - 1
if acc == 0:
exit(0)
# PROGRAM SPLITTING
program = input('Program: ').split(' ')
if '|' in program:
ind = program.index('|')
initial = program[:ind]
looping = program[ind:]
program.remove('|')
if '|' in program:
raise Exception('Incorrect number of separators')
else:
initial = program
looping = []
# BODY
acc = 1
interpret(initial)
while True:
interpret(looping)