Just a nice little brainfuck interpreter in Python.
Project description
Just a nice little brainfuck interpreter in Python.
Nope! This is brainfuck-fuck. You know there’s C, then C+, then C++? Well, there’s brainfuck, and now there’s brainfuck-fuck. Brainfuck-fuck is supposedly backwards compatible. So therefore this:
+++++++ [ > ++++++++++ < - ] > ++ . [-]<[-] ++++++++++ [ > ++++++++++ < - ] > +++++ .
does exactly the same thing as this:
=H.=i.
besides the fact that the first one uses two cells while the second uses one.
A full list of additions:
The = command. This sets the current cell’s value to the ASCII value of the character after the =. Therefore =H sets the cell to 72 (the ASCII value of H).
An if/else statement! The syntax is ? (code) : (code) !. When a ? is reached, it checks the current cell. If the current cell is 0, it skips to the corresponding :. Otherwise, it continues on until the :, then skips to the !. Thus + ? =Y : =N ! . prints out “Y” while ? =Y : =N ! . prints out “N”.
Functions! To define a function, use (@ symbol)(single ASCII character)(code)(pipe, |), e.g. @F+++++| (which simply adds 5). To call a function, use a caret (^) and then the ASCII character used to name the function, e.g. ^F (which calls the previously defined function F, thereby adding 5).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for brainfuck_fuck-2020.4.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9ccb7e19c8bc47a4102ba0ca970735642cd42c109a5230b1214cf42006f4325 |
|
MD5 | 128f975bb73680fc716994b856274f5d |
|
BLAKE2b-256 | 39a2a47a3c0d4e0c30b1cac46c2b37bf9af274f460b45bf9476d5c6f852ef367 |