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 details)

Uploaded Python 3

File details

Details for the file whitefuck-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: whitefuck-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.3

File hashes

Hashes for whitefuck-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7173da5219166af58fc512aba57e5f9c0a310fdd19ae6c28bbc8886591ac83b4
MD5 f13b7b31db40eb8e889ec6af6d6f659f
BLAKE2b-256 f1f5989990c64e282bfcda83bafd363305bc915b4dd9d2198548721c473fbd66

See more details on using hashes here.

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