The BrainFuck-like Languages Compiler (bflc) is a compiler framework that targets Brainfuck and closely related languages.
Before building, get the source code by cloning the repository.
git clone --recurse https://github.com/bynect/bflc.gitBuild the project using CMake.
cmake -B _build
make -C _buildGuaranteed to work for Linux, requires the Unix Makefile generator for CMake.
The compiler is a terminal interface for the blfc library.
--debugSet debug output--verboseor-vSet verbose output--helpor-hPrint help message--versionPrint version message--frontend=STRINGSet one of the available frontends. The default isbrainfuck--backend=STRINGSet one of the available backends. The default isamd64_asm--front=STRINGAlternative name for--frontendoption--back=STRINGAlternative name for--backendoption-oSet output file path. The default isoutput-freadUse read syscall (not available in all backends)-fwriteUse write syscall (not available in all backends)-fsyscallEquivalent to-freadand-fwrite-fcell=INTSet the number of cells (default is30000)
# Compile echo.bf to x86_64 nasm assembly
bflc echo.bf -o echo.asmThe amd64 backend is not supported at the moment.
To create x86_64 executables assemble the output of amd64_asm.
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.
- X86_64 assembly backend, uses NASM syntax (
amd64_asm) - X86_64 machine code backend, only for JIT-ing (
amd64)
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.
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.
The bflc framework is licensed under the terms and conditions of the Apache-2.0 License.