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 — contains all tokens
  • tokenizer — contains tokenize function
def tokenize(char: str) -> Token: ...
  • transpiler — contains transpile function
def transpile(token: Token) -> str: ...
  • code_generator — contains generate function that generate valid C code from given tokens
def generate(tokens: 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-2.0.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for bftc-2.0.0.tar.gz
Algorithm Hash digest
SHA256 845468a808fc0b279800531328cc4b45956c728c73c0adf26ebe0f86bbde3005
MD5 8b4c4679b463d0976de03350e65fbce6
BLAKE2b-256 50ec49a0cec976c5a66849ce946501e39ac5f6b63c6eeae7dab7ea61db09189b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bftc-2.0.0-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.26.0

File hashes

Hashes for bftc-2.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 5b9900ea4a7e2bd3c3d580741f63a1dcb89336362b968195b92092999848d212
MD5 3757949e2249746c6eaff07a1434db75
BLAKE2b-256 321790369814ea0e859742fc1e0f4ec3e72adfc60b476cc37e8888f2b605a9e6

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