Writing a Brainfuck Interpreter in Python
Brainfuck is a tiny language that includes only 8 simple commands, writing an interpreter for it is easy and is often seen as a simple programming exercise. Let’s write one in Python today. Reading files First of all I’ll write a simple base to load the file given on the command line, for this I usually like to use Python’s builtin ArgumentParser: #!/usr/bin/python3 # -*- coding: utf8 -*- import sys from argparse import ArgumentParser from pathlib import Path def run(instructions: str): # TODO pass if __name__ == "__main__": parser = ArgumentParser(description="Interpret Brainfuck code") parser....