Skip to content

Spelis/bfc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BFC - Brainf*ck compiler

A Brainf*ck compiler for Linux.

bfc translates Brainfuck into C and immediately feeds it into GCC, producing small standalone ELF executables. No interpreters, no virtual machines, no runtime dependencies.

Build the compiler

Just one command:

make

Build a brainfuck program

Just one more command:

cat input.bf | ./build/bfc > output

or:

echo "bf string" | ./build/bfc > output

Then running the program is as simple as:

./output

How it works

Brainf*ck source -> Lexer -> Parser -> AST -> C codegen -> GCC -> ELF executable

A simple Hello World! program is about 9.3kb big.

Limitations

  • Linux only
  • Soft-requires GCC (could be substituted for something else)
  • Finite memory tape (30kb)

Why?

Because interpreters suck.

Also because turning Brainf*ck into an ELF executable is just objectively fun.

License

MIT

About

Brainfuck compiler written in C

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors