Skip to content

Instantly share code, notes, and snippets.

View Reconcyl's full-sized avatar

Reconcyl Reconcyl

View GitHub Profile
@Reconcyl
Reconcyl / mmp.py
Last active November 2, 2017 04:18
Intepreter for the MMP esolang: https://esolangs.org/wiki/MMP
# An interpreter for the MMP (MultiMath Processor) esolang.
# Has no dependencies other than the standard library.
# A few things to note:
# - Cells contain unbounded integers.
# - Arithmetic is signed, and negative tape indices are allowed.
# - Tape and registers are initialized to 0.
# - Invalid commands are ignored.
# - IP out-of-bounds ends execution.
# - Instructions are indexed from zero.

MetaFractran is a version of Fractran in which the entire program is encoded in the program file's metadata - specifically, its file name and path.

Say the program file is located in /home/metafractran/7:3/99:98/13:49/39:35/36:91/10:143/49:13/7:11/1:2/91:1/10.mfc. Only the trailing components of the file path that match the regex \d+:\d+ will be kept, and the rest will be ignored. The file name can have an optional extension, which is ignored. The contents of the file do not matter; however, a compliant implementation must verify that the file exists.

This file corresponds to the program 7/3 99/98 13/49 39/35 36/91 10/143 49/13 7/11 1/2 91/1, with a starting number of 10.