GithubHelp home page GithubHelp logo

braindead-cc / bcc Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 1.0 318 KB

an optimizing compiler, debugger ("visualizer"), and interpreter for brainfsck.

License: MIT License

C 42.92% Tcl 8.20% Brainfuck 2.58% Makefile 4.72% CMake 3.14% Rust 38.45%
brainfuck brainfuck-interpreter brainfuck-compiler ridiculous waste-of-time satire joke

bcc's Introduction

The Braindead Compiler Collection

The Braindead Compiler Collection is an optimizing compiler, debugger ("visualizer"), and interpreter for brainfsck, an extremely simple, safe, and fast language for developing maintainable software.

Features

Simplicity

complexity is the bane of all software, simplicity is the most important quality.

-- cat-v.org

The language itself consists of just a few commands, which can be learned by going through the documentation in less than a minute. This results in simple, readable1, and maintainable code.

Despite being simple, Brainfsck was designed to give power to the developer. Anything you can do in any other language, you can theoretically do in Brainfsck.

Safety

  • no NULL.
  • no variables.
    • no global variables.
  • bounds checking.

Performance

  • as fast as C (the compiler/interpreter is written in C).
  • compiles to native binaries with no dependencies. 2

Compliant

BCC adds absolutely no project-specific extensions to the original Brainfsck (with the exception of the '#' command).

Fast compilation

  • compiling samples/lostkng.b with the C backend takes less than a second with bcc c -O1 samples/lostkng.b > lostkng.c.

Small, portable, and easy to build compiler

  • portable: this toolchain is written in C, and as we all know, no platform is complete unless it has a fully-functional C compiler.
  • fast to build: The entire toolchain builds in less than a second. 3
  • small: the toolchain is about 2,000 lines of code total (including the CMakeLists.txt and test script). The resulting binary is only ~23k in size.

Flexibility

  • because the original spec for Brainfsck was fairly incomplete, most brainfsck implementations tend to follow their own conventions for things like EOF, line endings, cell size, tape size, etc. BCC's solution is to provide all options, through runtime configuration.

Installation

See docs/INSTALL.md.

Usage

See bcc(1) and brainfuck(7).

Status

This tool is in alpha stage. A lot remains to be done (see docs/ROADMAP.md), but the interpreter and compiler (with the C and Rust backends) are in a working state. The debugger is still mostly unimplemented.

This project is expected to be in a beta-quality state by the time of the 1.0.0 release.

FAQ

  1. Q: why
    • A: yes
  2. Q: no
    • A: what?

1: whether your Brainfsck code is readable depends on what font you're using. (I would recommend either ttyp0 or cozette.)

2: except the libc. If you want to remove that dependency as well, you can compile the generated C code with -static.

3: compiled with gcc with flags to optimize for space (-Os -s) on x86_64.

bcc's People

Contributors

kiedtl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

esovm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.