whitefuck
(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.
Metadata
Release files for whitefuck 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| whitefuck-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / whitefuck-1.0.0-py3-none-any.whl
| Download URL | whitefuck-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7173da5219166af58fc512aba57e5f9c0a310fdd19ae6c28bbc8886591ac83b4
|
|
BLAKE2b-256 checksum How to use checksums |
f1f5989990c64e282bfcda83bafd363305bc915b4dd9d2198548721c473fbd66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|