GitHub - apoos-maximus/bfcompiler: brainfuck-compiler written in c/c++

brainfuck-compiler written in c/c++

Language Specifications

  • Addition and Subtraction are the only atomic operations present, there are no abstractions like multiplication and division
  • Language character-set : +-<>[].,
  • The tape has 30000 cells

Compilation Instructions

  • set-up llvm on the host system : version used for this project-10.0.0
  • add LLVM_HOME/bin to $PATH if llvm-config and clang++ are not installed already.

This will generate brainfuck-compiler binary bfcompiler

lol@lol$ make clean
lol@lol$ make

Compile the sample-bf program to host-architecture object-file output.o

  • this will print llvm-IR code for the mainFunction of llvm-IR representation and generate object file.
lol@lol$ ./bfcompiler hellow.bf

Link the Object file to produce executable a.out

Run executable to see output of brainfuck code

lol@lol$ ./a.out 
Hello World!
lol@lol$

hence compiling the brainfuck code to the host-architecture binary.