Skip to content
/ bfcc Public

A beautiful brainfuck compiler, interpreter and REPL written in Go. ✨

Notifications You must be signed in to change notification settings

sweetbbak/bfcc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bfcc

An over egineered brainf*ck compiler and interactive debugger written in Golang and Bubbletea.

example of bftui running

Installation

you can use just to build:

# build the compiler
just
# build the TUI
just bftui

or

go build -o bfcc ./cmd/bfcc
go build -o bftui ./cmd/bftui

# or install with Go
go install github.com/sweetbbak/bfcc/cmd/bfcc@latest
go install github.com/sweetbbak/bfcc/cmd/bftui@latest

Usage

# building a simple program (uses C backend by default)
./bfcc ./examples/helloworld.bf -o hello
# run the live interpreter (you can shorthand interpreter as interp or w/e as long as the first char is 'i')
./bfcc --backend=interpreter ./examples/helloworld.bf
# optionally execute the compiled program
./bfcc --backend=go ./examples/helloworld.bf -o hello --run

running the debugger UI:

./bftui

backends

  • Go
  • C
  • Asm
  • Interpreted

Benchmarks

Command Mean [ms] Min [ms] Max [ms] Relative
./mandelbrot-c 512.0 ± 1.7 510.3 514.6 1.00
./mandelbrot-go 2217.8 ± 1.2 2216.1 2219.6 4.33 ± 0.01
./bfcc --backend=interp ./examples/mandelbrot.bf 13572.8 ± 154.1 13347.0 13808.8 26.51 ± 0.31

Huge thanks to

Katie Ball skx/bfcc brainfuck.org

About

A beautiful brainfuck compiler, interpreter and REPL written in Go. ✨

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published