Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/liamg/bfc
A compiler for brainfuck by someone who has no idea how compilers work
https://github.com/liamg/bfc
bad brainfuck brainfuck-compiler compiler
Last synced: 11 days ago
JSON representation
A compiler for brainfuck by someone who has no idea how compilers work
- Host: GitHub
- URL: https://github.com/liamg/bfc
- Owner: liamg
- Created: 2022-02-03T19:00:32.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-04T21:46:04.000Z (almost 3 years ago)
- Last Synced: 2024-10-12T21:17:34.963Z (25 days ago)
- Topics: bad, brainfuck, brainfuck-compiler, compiler
- Language: Go
- Homepage:
- Size: 37.1 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bfc
*bfc* is a bad (probably) [Brainfuck](https://en.wikipedia.org/wiki/Brainfuck) compiler.
It compiles only to *x64 assembly*, though there are flags that you can use to get your code assembled and linked into a standard Linux elf executable.
I wrote this compiler because I had no idea how to write compilers, and thought it might be interesting. It was very interesting and I still have no idea how to write compilers because Brainfuck is a very syntactically simple language and has very few possible operations. I'll be working on a C compiler next instead. I didn't think this through.
## Installation
Grab the binary from the [latest release](https://github.com/liamg/bfc/releases/latest).
## Usage
### Compile Brainfuck to x64 asm:
```bash
bfc -o hello.asm hello.bf
```### Compile and assemble Brainfuck to x64 object:
```bash
bfc -a -o hello.o hello.bf
```### Compile, assemble and link Brainfuck to ELF binary:
```bash
bfc -al -o hello hello.bf
```### All of the above and run the resultant binary
```bash
bfc -r hello.bf
```