Skip to main content

A simple BrainFuck extension with macros

Project description

RainDuck

A simple BrainFuck extension with macros transpiled to BrainFuck.

Installation

Use pip to install RainDuck.

pip install rainduck

Usage

# transpiles code to BrainFuck
rainduck my-program.rd

# use your favourite BrainFuck compiler or interpreter
brainfuck my-program.bf

Basic Syntax

// comments are created with '//'
let // if you want to define macros, you must start with the word 'let'
#import(folder/file.rd) // imports all global macros in folder/file.rd
clear = {[-]} // macro without arguments
five_left = {5<} // integer repeats given string
ten_right = {-2five_left} // negative integer reverses string and turns > <-> < and + <-> -
error = {-3[+]} // loop cannot be inverted, this raises an error...
no_error = {-1 error} // ...but double iversion doesn't have effect, this raises no error
move_cell(
    from;
    to = < // default value for this argument
) = {from [- -1from to + -1to from] -1from}

// most whitespace characters are optional
copy_cell(from={};to={};storage=<)={from[--1from storage+-1storage to+-1to from]move(storage)-1from}
in // end of macro definitions
// follows executed code
move( // macro call
    { // code blocks are created with curly brackets...
        let five_left={5{<<>}} in // ...and can contain local macro definition...
        3 {five_left >} // ...but don't have to
    };
    >
)

Contributing

Pull requests are welcome.

License

MIT

Project details


Download files

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

Source Distribution

rainduck-0.3.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rainduck-0.3.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file rainduck-0.3.0.tar.gz.

File metadata

  • Download URL: rainduck-0.3.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for rainduck-0.3.0.tar.gz
Algorithm Hash digest
SHA256 3339b0ad842f4d7e11a05fc830b77163a50317bd79fe9b6a0146017ba2e19ddb
MD5 001df573afa8807ee0c91da8429952fa
BLAKE2b-256 0f49f969f4e16a0e7ec7df7b34bbc0b1800e7f30164894f55264a02f681e730e

See more details on using hashes here.

File details

Details for the file rainduck-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: rainduck-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for rainduck-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e7aa9c2b33701777c5f4d4a41f8fea09e2b92538b25e5a3c1fba40fc891d02c
MD5 61f72ba88a030b7ce8557b0863bf162d
BLAKE2b-256 e1facdff2ba87bd3a9386b1ee976551737472c96aed7c7363a23f92df84f4374

See more details on using hashes here.

Supported by

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