Giter Club home page Giter Club logo

bfukc's Introduction

BfukC

BfukC is an optimizing Brainfuck compiler; it reads in a Brainfuck source file and generates an optimized native code executable. Optionally it can run the program directly using its built-in bytecode interpreter.

To produce native code executables BfukC produces LLVM assembly code, which it compiles into optimized binary code using clang. This naturally means that in order to compile native code you need clang installed and in your $PATH.

The compiler uses the Brainfuck-specific optimization techniques mentioned here, except the scanloop and offset optizations. Due to aggressive optimization techniques utilized by the clang LLVM compiler, these are not strictly necessary to produce fast executables but they do shorten compilation times considerably due to Brainfuck's extreme verbosity.

Usage

Using the compiler is simple. For example, to compile and run the "Hello, world" example found in example folder:

$ ./bfukc example/hello.bf
$ example/hello
Hello World!

To run the code directly:

$ ./bfukc -b example/hello.bf
Hello World!

Installation

BfukC is written in OCaml using Jane Street's Core libraries. To compile it, install ocaml and opam using your favorite package manager and then install the required dependencies:

$ opam install core core_extended

After which you can compile the compiler:

$ corebuild bfukc.native

This will place the binary executable bfukc.native into _build subdirectory (and also symlinks it to current directory).

bfukc's People

Stargazers

WON SEOB SEO avatar Sami Niiranen 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.