Bfc - A compiler for brainfuck by someone who has no idea how compilers work

bfc

bfc is a bad (probably) 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.

Usage

Compile Brainfuck to x64 asm:

bfc -o hello.asm hello.bf

Compile and assemble Brainfuck to x64 object:

bfc -a -o hello.o hello.bf

Compile, assemble and link Brainfuck to ELF binary:

bfc -al -o hello hello.bf

All of the above and run the resultant binary

bfc -r hello.bf
Owner
Liam Galvin
Open Source at @aquasecurity
Liam Galvin
Similar Resources

A simple virtual machine - compiler & interpreter - written in golang

go.vm Installation Build without Go Modules (Go before 1.11) Build with Go Modules (Go 1.11 or higher) Usage Opcodes Notes The compiler The interprete

Dec 17, 2022

Compiler for a small language into x86-64 Assembly

Compiler This project is a small compiler, that compiles my own little language into X86-64 Assembly. It then uses yasm and ld to assemble and link in

Dec 13, 2022

Monkey programming language project from 'Writing An Interpreter In Go'and 'Writing A Compiler In Go' Books

Monkey programming language project from 'Writing An Interpreter In Go'and 'Writing A Compiler In Go' Books

Monkey Monkey programming language 🐒 project from "Writing An Interpreter In Go

Dec 16, 2021

Cc - Toy C compiler for golang

Grammars program = funcDecl* decl = declspec declarator ("{" compou

May 2, 2022

A multi-pass compiler written in Go comprised of scanner, recursive-descent parser, generation of AST, intermediate representation (ILOC), and code generation (Armv8).

GoLite Project - Go Huskies! This is a project conducted and led in the course MPCS 51300 Compilers at the University of Chicago. In a group of two, w

Jan 10, 2022

An experimental port of TinyRb to Google go, both as a means of learning go and exploring alternate approaches to implementing Ruby. Work is currently focused on the GoLightly VM.

tinyrb¶ ↑ A tiny subset of Ruby with a Lua'esc VM. Everything in TinyRb should run in the big Ruby. (except bugs and things that don't comply to the p

Sep 22, 2022

A Brainfuck to WebAssembly compiler written in Go.

brainfuck2wasm A Brainfuck to WebAssembly compiler written in Go. I am writing this compiler for a Medium article. When I complete the compiler, I'll

Jun 6, 2022

Tiny binary serializer and deserializer to create on demand parsers and compilers

Parco Hobbyist binary compiler and parser built with as less reflection as possible, highly extensible and with zero dependencies. There are plenty pa

Nov 9, 2022

Someone tried to unlock your device

Someone tried to unlock your device

PC Auth Notifier Someone tried to unlock your device I made this project because I want to learn flutter by myself, unfortunately I can't use my XPS c

Sep 17, 2022

A command that someone swastikas when executed

A command that someone swastikas when executed

bankaiコマンド 実行すると誰かが卍解するコマンドです。 使い方 1. Homebrewでインストール brew tap krpk1900/bankai b

May 10, 2022

Golang-samples - Help someone need some practices when learning golang

GO Language Samples This project is to help someone need some practices when lea

Jan 11, 2022

Go compiler made from scratch, which can compile itself. It's going to be the smallest and simplest go compiler in the world.

Babygo, a go compiler made from scratch Babygo is a small and simple go compiler. (Smallest and simplest in the world, I believe.) It is made from scr

Jan 8, 2023

Compiler as a Service is a compiler that is available over http/https and gRPC

BlakBoks(CaaS) Elasticsearch but for compiling untrusted code Compiler as a Service is a compiler that is available over http/2 and gRPC. Setup First

Nov 24, 2021

ReCT-Go-Compiler - A compiler for the ReCT programming language written in Golang

ReCT-Go-Compiler A compiler for the ReCT programming language written in Golang

Nov 30, 2022

ReCT-Go-Compiler - A compiler for the ReCT programming language written in Golang

ReCT-Go-Compiler A compiler for the ReCT programming language written in Golang

Nov 30, 2022

Minutes is a CLI tool for synchronizing work logs between multiple time trackers, invoicing, and bookkeeping software to make entrepreneurs' daily work easier.

Minutes is a CLI tool for synchronizing work logs between multiple time trackers, invoicing, and bookkeeping software to make entrepreneurs' daily work easier.

Minutes is a CLI tool for synchronizing work logs between multiple time trackers, invoicing, and bookkeeping software to make entrepreneurs' daily work easier.

Aug 8, 2022

Go library that provides fuzzy string matching optimized for filenames and code symbols in the style of Sublime Text, VSCode, IntelliJ IDEA et al.

Go library that provides fuzzy string matching optimized for filenames and code symbols in the style of Sublime Text, VSCode, IntelliJ IDEA et al.

Go library that provides fuzzy string matching optimized for filenames and code symbols in the style of Sublime Text, VSCode, IntelliJ IDEA et al. This library is external dependency-free. It only depends on the Go standard library.

Dec 27, 2022

its the same idea as bruh-bot, but with golang, and add more bots

its the same idea as bruh-bot, but with golang, and add more bots

bruh-bot but more powerful! requirements python go you can used on mac and linux the idea its really simple, can make a lot of bots with the same task

Jul 7, 2021

POC for test the idea of Phoenix LiveView in Go and Echo

go-echo-live-view Little POC for test the idea of Phoenix LiveView in Go and Echo (https://github.com/labstack/echo) The idea was stolen from https://

Nov 15, 2022
ReCT-Go-Compiler - A compiler for the ReCT programming language written in Golang

ReCT-Go-Compiler A compiler for the ReCT programming language written in Golang

Nov 30, 2022
ReCT-Go-Compiler - A compiler for the ReCT programming language written in Golang

ReCT-Go-Compiler A compiler for the ReCT programming language written in Golang

Nov 30, 2022
🧠 A Brainfuck interpreter written in Go

brainfuck-go A Brainfuck interpreter written in Go. How Brainfuck works Brainfuck is an esoteric programming language designed to have the simplest co

Sep 30, 2022
A little brainfuck interpreter written in Go

Brainfuck_go_interpreter A little brainfuck interpreter written in Go from what I've done in coding game Usage $ go build brainfuck.go $ ./brainfuck P

Dec 13, 2021
An interpreter written in go for a brainfuck-based language called €*

eurostar-go-interpreter This is an interpreter written in go for a brainfuck-bas

Sep 14, 2022
BfInterpreterGo - Brainfuck interpreter built in golang

bfInterpreterGo Brainfuck interpreter built in golang. Usage main.exe --filename

Jan 7, 2022
Brainfuck interpreter in golang

Brainfuck Interpreter in Go brianfuck interpreter implimented in go brianfuck he

Aug 2, 2022
Bf - A brainfuck interpreter written in Go while the programmer was drunk
Bf - A brainfuck interpreter written in Go while the programmer was drunk

BF A (not well tested) brainfuck interpreter written in Go while the programmer

Feb 17, 2022
Gentee - script programming language for automation. It uses VM and compiler written in Go (Golang).

Gentee script programming language Gentee is a free open source script programming language. The Gentee programming language is designed to create scr

Dec 15, 2022
GopherLua: VM and compiler for Lua in Go

GopherLua: VM and compiler for Lua in Go. GopherLua is a Lua5.1 VM and compiler written in Go. GopherLua has a same goal with Lua: Be a scripting lang

Dec 31, 2022