Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gargakshit/bfcc
Brainf*ck to LLVM compiler written in Go
https://github.com/gargakshit/bfcc
Last synced: 1 day ago
JSON representation
Brainf*ck to LLVM compiler written in Go
- Host: GitHub
- URL: https://github.com/gargakshit/bfcc
- Owner: gargakshit
- Created: 2023-01-06T17:07:11.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T17:07:25.000Z (about 2 years ago)
- Last Synced: 2025-01-15T02:58:18.319Z (4 days ago)
- Language: Go
- Size: 5.86 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bfcc
[Brainf*ck](https://en.wikipedia.org/wiki/Brainfuck) compiler and interpreter
written in Go.## Interpreter
The interpreter contained in the `cmd/bfi` directory is a basic brainf*ck
interpreter that does no optimizations.## Compiler
The compiler contained in `cmd/bfcc` is a LLVM-based compiler for brainf*ck.
Currently, it emits [LLVM IR](https://llvm.org/docs/LangRef.html) on the
`stdout` which may be piped to clang for compilation.The compiled program is expected to be linked with `libc` for `getch`, `putch`
and `memset`.### Compiling a program
```shell
go run ./cmd/bfcc | clang -x ir -o -
```## Performance
All these tests are run on a R7-5700U running Windows 11 with the following
flags for `clang`: `-flto -O3 -fuse-ld=lld-link`| Program | `bfi` | `bfcc` |
|--------------------|-------------------------|---------|
| Tower of hanoi | 14.895s | 0.029s |
| Mandelbrot | 33.511s | 0.613s |
| Mandelbrot Extreme | did not complete in 30m | 76.102s |The compiled version here is anywhere from **50-500 times** faster.