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

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

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