https://github.com/sweetbbak/bfcc
A beautiful brainfuck compiler, interpreter and REPL written in Go. ✨
https://github.com/sweetbbak/bfcc
Last synced: 4 months ago
JSON representation
A beautiful brainfuck compiler, interpreter and REPL written in Go. ✨
- Host: GitHub
- URL: https://github.com/sweetbbak/bfcc
- Owner: sweetbbak
- Created: 2024-09-08T06:04:15.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-09-14T21:27:46.000Z (9 months ago)
- Last Synced: 2024-09-15T13:44:12.946Z (9 months ago)
- Language: Go
- Size: 6.07 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bfcc
An over egineered `brainf*ck` compiler and interactive debugger written in Golang and Bubbletea.

# Installation
you can use `just` to build:
```sh
# build the compiler
just
# build the TUI
just bftui
```or
```sh
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
```sh
# 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:
```sh
./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


