Yet another Brainfuck interpreter written in Python.
For sample programs navigate to esolangs wiki or here.
Run directly as a shell script:
$ cat > file.b
#!/usr/bin/env brainfuck.py
++++++++++[>++++++<-]>+++++.
^D
$ chmod +x file.b
$ ./file.b
A
Run as a Python script:
$ brainfuck.py /path/to/file.b
Run as a Python module:
$ python -m brainf /path/to/file.b
Run as a Python Executable (PEX):
$ python brainf-linux.pex /path/to/file.b
Run as a platform-specific native executable:
$ ./brainfuck /path/to/file.b
See technical documentation for more details.
Source code:
$ git clone https://github.com/bzaczynski/brainf.git
In a new virtual environment:
$ pip install .
To uninstall:
$ pip uninstall brainf
Using PyInstaller will create a platform-specific executable file which bundles Python interpreter as well as all the required libraries.
$ mkvirtualenv brainf
$ pip install . pyinstaller
$ pyinstaller --onefile --additional-hooks-dir src/brainf bin/brainfuck.py
Usage:
$ dist/brainfuck samples/hello.b
Hello World!
To build a binary distribution with Docker and PEX follow the steps below.
- Create a new Docker image.
$ docker build -t brainf:linux -f Dockerfile.linux .
- Run interim container to extract .pex file from the image.
$ docker run --rm brainf:linux cat /root/brainf-1.0.0-linux.pex > brainf-linux.pex
To build Sphinx documentation:
$ cd docs/
$ make clean html
The recommended way to publish a project on PyPI is with twine since it uses SSL by default.
- Install twine:
$ pip install twine
- Create source and binary distributions:
$ python setup.py sdist bdist_wheel
-
Upload to Python Package Index.
Test PyPI:
$ twine upload --repository-url https://test.pypi.org/legacy/ dist/*
PyPI:
$ twine upload dist/*
This project is licensed under the MIT License.