The Past

From Esolang
Jump to navigation Jump to search

The Past is a time-traveling esolang by User:PythonshellDebugwindow.

Memory model

The Past uses an arbitrary-size signed integer accumulator.


The final value of the accumulator is output (if the program goes into an infinite loop, then nothing will be output).


Command Effect
+ Increment the accumulator
- Decrement the accumulator
. Wait a tenth of a second
< Go back one millisecond in the past


Written in Python 3. A filename is read as a command line argument. Note that this implementation is somewhat slow and can take some time to start the program. If it is interrupted before the program starts, incorrect output may be produced.

import sys
import time

with open(sys.argv[1]) as f: code =
dt = 0.1*code.count('.') - 0.001*code.count('<')
acc = code.count('+') - code.count('-')
if dt >= 0:
    print('Starting program...')
    print(f'Accumulator: {acc}')
    print(f'Accumulator: {acc}')
    print('Starting program...')