marcpaq / b1fipl

A Bestiary of Single-File Implementations of Programming Languages
995 stars 38 forks source link

Add bc, a single file brainfuck compiler written in C #20

Closed rachelambda closed 3 years ago

rachelambda commented 3 years ago

bc is a small brainfuck compiler I wrote, it's less than 370 lines of code in a single file and translates brainfuck text files into ELF binaries for x86_64 linux. It even optimizes multiple +- and <> operations after each other into add instructions instead of inc and dec instructions!

rachelambda commented 3 years ago

Here is a little preview of me compiling a brainfuck mandlebrot program from here and running the outputted executable. 2021-02-05-21:33:05-screenshot

marcpaq commented 3 years ago

That's pretty cool. Thanks for sharing!