666/666.py
2014-01-13 23:53:42 +01:00

28 lines
608 B
Python
Executable File

import argparse
import malbolge
def main():
parser = argparse.ArgumentParser(description="Malbolge interpeter")
parser.add_argument("-f", "--file",
action="store_true", help="specify a file")
parser.add_argument("input", type=str,
help="malbolge program (string or file)")
args = parser.parse_args()
if args.file:
try:
program = open(args.input).read()
except FileNotFoundError:
parser.error("File not Found.")
if program == "":
parser.error("File is empty.")
else:
program = args.input
machine = malbolge.Machine()
machine.run(program)
if __name__ == "__main__":
main()