Socket
Socket
Sign inDemoInstall

github.com/classpythonaddike/brainfcompiler

Package Overview
Dependencies
0
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/classpythonaddike/brainfcompiler


Version published

Readme

Source

BrainF Compiler

This is a BrainF Compiler written in Golang. It converts BrainF code to C++ code, and then finally machine language, thus generating an executable. My aim is for it to be the fastest BrainF executor I've written yet.

As of now, this compiler is able to draw a mandelbrot set in 11 seconds. take a look at mandelbrot.bf for the program

Setup

  1. If you are on Windows, Linux or a Mac, you can go to the Releases tab to download the latest release.

  2. If you are on a different operating system, you will need to compile it on your machine. Create a file named main.go and paste the following code into it:

package main

import (
  "flag"
  bfcompiler "github.com/classPythonAddike/brainfcompiler"
)

func main() {

  compiler := flag.String("compiler", "gcc", "Compiler to use at runtime")
  file := flag.String("filename", "", "BrainF file to compile")
  output := flag.String("out", "", "Output file")

  flag.Parse()

  bfcompiler.Compile(*file, *compiler, *output)
}
  1. If you don't want to use the CLI, you can always invoke it from a script! You just need to download this package with go get github.com/classPythonAddike/brainfcompiler and then use the Compile function to compile a BrainF program.

Usage

You can invoke the script like this:

> brainfcompiler.exe -filename=filename.bf -out=filename.exe [-compiler="g++"]

Where:

  1. filename is the brainf file you want to compile
  2. out is the output file you want. Remember, on Windows, it will need to have a suffix of .exe!
  3. compiler is the C compiler you want to use. This option is not compulsory. The compiler used by default is gcc. Supported compilers are gcc and g++

FAQs

Last updated on 06 May 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc