This release is a pre-release and may not be stable for production use.
Brainfucky is a brainfuck interpreter written in python.
About Brainfuck
Brainfuck is an esoteric programming language. The language has only 8 symbols, each performing certain functions, see below.
+ |
Increment the value of current cell by 1. |
- |
Decrement the value of current cell by 1. |
> |
Move the current cell pointer to right, increment the pointer by 1. |
< |
Move the current cell pointer to left, decrement the pointer by 1. |
. |
Print the ascii character corresponding to the value of current cell. |
, |
Take an ascii input from user, and store its ascii value in current cell |
[ |
if the byte at the data pointer is zero, then instead of moving the instruction pointer forward to the next command, jump it forward to the command after the matching ] command. |
] |
if the byte at the data pointer is nonzero, then instead of moving the instruction pointer forward to the next command, jump it back to the command after the matching [ command. |
About Implementation
The memory element, the tape is emulated using the python list.
Value of ith element in the list corresponds to the value of cell i.
A cell pointer is used to point towards the current cell.
+ and - increments the value of cell pointed by the cell pointer.
> and < increments and decrements the cell pointer effectively, moving the tape right or left.
Instructions in a block are executed and at the end of the execution of last instruction, value of current cell is checked, if it is 0, move on, else execute the block again.
Install
$ pip install brainfucky
Run
To run your brainfuck program do the following
$ brainfucky --file examples/hello_world.bf
executing file examples/hello_world.bf
Hello World!
$ brainfucky --file examples/triangle.bf
executing file examples/triangle.bf
*
* *
* *
* * * *
* *
* * * *
* * * *
* * * * * * * *
* *
* * * *
* * * *
* * * * * * * *
* * * *
* * * * * * * *
* * * * * * * *
* * * * * * * * * * * * * * * *
* *
* * * *
* * * *
* * * * * * * *
* * * *
* * * * * * * *
* * * * * * * *
* * * * * * * * * * * * * * * *
* * * *
* * * * * * * *
* * * * * * * *
* * * * * * * * * * * * * * * *
* * * * * * * *
* * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Metadata
Release files for brainfucky 0.1.dev1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| brainfucky-0.1.dev1.tar.gz | 4.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| brainfucky-0.1.dev1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 10.9 kB
Release files / brainfucky-0.1.dev1.tar.gz
| Download URL | brainfucky-0.1.dev1.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f2404d4fa257a9c667016086751c6e19ed5357f9c596ff448a438f9f816bc1a
|
|
BLAKE2b-256 checksum How to use checksums |
2678588f4a254a5267a7d64938cba7f2691cf656f0d31c314760cac78dca67bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / brainfucky-0.1.dev1-py2.py3-none-any.whl
| Download URL | brainfucky-0.1.dev1-py2.py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
bcdcad3c6bca3890adde204b18bf7927855f55eb48caea972080ce470a61657a
|
|
BLAKE2b-256 checksum How to use checksums |
95a56ac16ee906f6d099a3921d1a2dd10b3485ccd93ff8750b7c239e2d2557a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |