Mogus

From Esolang
Jump to navigation Jump to search

Mogus is a stack-based esolang by VilgotanL, which is defined by only 5 instructions.

Instructions

m Pushes a 1 to the stack
o Pops A then B and pushes B-A
g Pops a number from the stack and goes to that line number starting at 1, if the line number is out of range the behaviour is undefined
u Pops a number, if it's non-zero, print it as an ascii character, otherwise take a character of input and push it's ascii character to the stack
s Moves the bottom value in the stack to the top of the stack (rotate)

Any other instructions are ignored by the interpreter. The stack is composed of unbounded integers, and the program halts whenever it reaches the end.

Computational class

Mogus can be proven Turing complete via translation of a cyclic tag program into Mogus (User:TriMill provided the following program):

#!/usr/bin/python3

instr = input("productions > ")
tape = input("data > ")

program = tape.replace("0", "mmo").replace("1", "m")
program += "mmmomomomoog\nmmomoommomoog\nmmomoog\n"
for i, prod in enumerate(instr.split(";")):
    program += "mm" + "mo"*(2*i+4) + "osmmomoommomoog\n" \
        + prod.replace("0", "mmo").replace("1", "m") + "\n"
program += "mmmomomomoog"

print(program)

Examples

Patterns

  • mmo Push 0
  • mmomoo Increment the top of the stack
  • mo Decrement the top of the stack
  • mmou Input a character
  • u Output a character assuming its not 0

Programs

Truth machine

Updated, the previous one goto'd line 0 if the input was 0 which causes undefined behaviour, but now it goes to the last and empty line.

mmoummmomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomooog
mmmomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomooummmomomomoog
mmmomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomooummmomomoog
(EMPTY LINE USED FOR HALTING)

Cat program

mmouumg

Hello World

mmommomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomoou
mmommomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomoou
mmommomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomoou
mmommomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomoou
mmommomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomoou
mmommomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomoou
mmommomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomoou
mmommomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomoou
mmommomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomoou
mmommomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomoou
mmommomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomoou
mmommomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomoou
mmommomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomomoou
mmommomomomomomomomomomomoou

Implementations

https://github.com/VilgotanL/Esolang-implementations/blob/master/py/mogus/mogus.py Python implementation, with a few programs and useful tools