Giter Club home page Giter Club logo

bflc's Introduction

The bflc framework

Overview

The BrainFuck-like Languages Compiler (bflc) is a compiler framework that targets Brainfuck and closely related languages.

Build

Before building, get the source code by cloning the repository.

git clone https://github.com/bynect/bflc.git

Build the project using CMake.

cmake -B _build
make -C _build

Note

Guaranteed to work for Linux, requires the Unix Makefile generator for CMake.

Compiler

The compiler is a terminal interface for the blfc library.

Options

  • --debug Set debug output
  • --verbose or -v Set verbose output
  • --help or -h Print help message
  • --version Print version message
  • --frontend=STRING Set one of the available frontends. The default is brainfuck
  • --backend=STRING Set one of the available backends. The default is amd64_asm
  • --front=STRING Alternative name for --frontend option
  • --back=STRING Alternative name for --backend option
  • -o Set output file path. The default is output
  • -fread Use read syscall (not available in all backends)
  • -fwrite Use write syscall (not available in all backends)
  • -fsyscall Equivalent to -fread and -fwrite
  • -fcell=INT Set the number of cells (default is 30000)

Example

# Compile echo.bf to x86_64 nasm assembly
bflc echo.bf -o echo.asm

Note

The amd64 backend is not supported at the moment. To create x86_64 executables assemble the output of amd64_asm.

Library

The framework is by default built as a standalone static library libbflc.a, that can be easily linked with your projects. The frontends and backends are not included in the static library, so you must compile them separately.

Supported frontends

Supported backends

Jit integration

Backends may generate machine code (for example amd64). Since you can use the framework as a library you can create a JIT quite easily. A practical integration example is also available.

Contributing

Contributions are welcome. Please open an issue first for major changes.

Before pushing contributions, please check for errors, memory leaks and other problems with either Asan or Valgrind.

License

The bflc framework is licensed under the terms and conditions of the Apache-2.0 License.

bflc's People

Contributors

bynect avatar ganajtur0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

ganajtur0

bflc's Issues

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.