Git Product home page Git Product logo

bf_compiler's Introduction

bf_compiler

Compiles brainfuck code to LLVM IR, and potentially runs it with McJIT.

Requirements

  • Python 3
  • llvmlite (install with python3 -m pip install --user llvmlite)

Usage

Place some brainfuck code into a file, and name it what you want. For the sake of simplicity, we'll assume your file is named example.bf.

After installing the requirements, you can choose to:

  • Run your brainfuck code directly by running python3 bf_compiler.py --run example.bf.

  • Compile your brainfuck to bitcode by running python3 bf_compiler.py --bitcode example.bf, which will emit a example.bc file.

You can compile your LLVM bitcode to machine code by running clang example.bc -o example, which will compile your LLVM bitcode directly to machine code. You may get a warning about a "triple", but don't worry about that. ;)

Thanks To

My friend Zaab1t for giving me the idea and the llvmlite reccomendation.

I made this to get my feet wet with LLVM, and to have fun.

bf_compiler's People

Contributors

purplemyst avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.