Skip to main content

Simple Brainfuck to C transpiler

Project description

🧠 Brainfuck to C transpiler

from bftc import code_generator, tokenizer


with open("code.bf") as bf_source:
    tokens = [tokenizer.tokenize(char) for char in bf_source.read()]
    with open("code.c", "w") as c_source:
        c_source.write(code_generator.generate(tokens))

Modules

  • tokens — contain all tokens
  • tokenizer — contain tokenize function
def tokenize(char: str) -> Token: ...
  • transpiler — contain transpile function
def transpile(token: Token) -> str: ...
  • code_generator — contain generate function that generate valid C code from given tokens
def generate(list[Token]) -> str: ...

Install

pip install bftc

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

bftc-1.0.1.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

bftc-1.0.1-py2.py3-none-any.whl (4.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file bftc-1.0.1.tar.gz.

File metadata

  • Download URL: bftc-1.0.1.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.22.0

File hashes

Hashes for bftc-1.0.1.tar.gz
Algorithm Hash digest
SHA256 1631adc5b5160cbf3d58817783a67b5d53c65d63e0a843664394373a77bc66c8
MD5 a764cde4e8928c541a89defb3b30c027
BLAKE2b-256 23f13e439dcc36b1cb3c7ae94ffa3b34fe57805d703748d922a5b03fefc469f4

See more details on using hashes here.

File details

Details for the file bftc-1.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: bftc-1.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.22.0

File hashes

Hashes for bftc-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f5d6969ddb552b94d060ae9faf0810d60f0ee607f523b2000e182aa42d2312d6
MD5 e67d2b7fc10b1208fca5343e91435dd5
BLAKE2b-256 ac95f12292133d13e3bc221b381c5c069d330e51065de4798f7a4f3232de5a92

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