Skip to main content

(Whitespace + Brainfuck) / 2 = Whitefuck

Project description

whitefuck

PyPi

(Whitespace + Brainfuck) / 2 = Whitefuck


Installation

Run this:

pip install whitefuck

Syntax

In this doc,
"s" means "Space", "t" means "Tab", "b" means "Breakline".

In whitefuck In brainfuck How does it work
ss + increment (increase by one) the byte at the data pointer.
st - decrement (decrease by one) the byte at the data pointer.
ts > increment the data pointer (to point to the next cell to the right).
tt < decrement the data pointer (to point to the next cell to the left).
sss . output the byte at the data pointer.
sst , accept one byte of input, storing its value in the byte at the data pointer.
sts [ 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.
stt ] 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.

Usage

usage: __main__.py [-h] [-m {run,convert}] [-i INPUT] [-c COUNTER] [-o OUTPUT] file

positional arguments:
  file                  File to run

optional arguments:
  -h, --help            show this help message and exit
  -m {run,convert}, --mode {run,convert}
                        Mode. Default: run

Run:
  -i INPUT, --input INPUT
                        A input.
  -c COUNTER, --counter COUNTER
                        Number of counters to make.

Convert:
  -o OUTPUT, --output OUTPUT
                        Path to export result.

Use on script

>>> import whitefuck as wf
>>> with open("./example/helloworld.wf") as f:
...   s = f.read()
...
>>> wf.run(s)
Hello World!
>>> f = wf.make_function(s)
functools.partial(<function run at 0x00000203123669D0>, '  \n  \n  \n  \n  \n  \n  \n  \n  \n \t \n\t \n  \n  \n  \n  \n  \n  \n  \n  \n\t \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n\t \n  \n  \n  \n\t \n  \n\t\t\n\t\t\n\t\t\n\t\t\n \t\n \t\t\n\t \n   \n\t \n  \n  \n   \n  \n  \n  \n  \n  \n  \n  \n   \n   \n  \n  \n  \n   \n\t \n  \n  \n  \n  \n  \n   \n\t\t\n\t\t\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n   \n\t \n   \n  \n  \n  \n   \n \t\n \t\n \t\n \t\n \t\n \t\n   \n \t\n \t\n \t\n \t\n \t\n \t\n \t\n \t\n   \n\t \n  \n   \n\t \n  \n   \n', '', 1024)
>>> f()
Hello World!

Prerequisites

  • Python 3.8 (Please make GitHub issue if you can use this lib on different python version)

License

Please see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

whitefuck-1.0.0-py3-none-any.whl (5.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page