Git Product home page Git Product logo

brainfuck-cpu's Introduction

Brainfuck CPU

This is an experiment where I suppose we are in a world where we only have:

  • a CPU able to run Brainfuck code
  • a text editor

For information, Brainfuck is a minimalism esoteric programming language, but still Turing-complete.

Brainfuck interpreter and compiler

bf.py is the Brainfuck interpreter and compiler available.

You can execute a Brainfuck source code by running ./bf.py code.bf Using the compiler (option -c) is a way to make the code faster (it uses gcc or clang with flag -O3).

Notes: cells are 8-bit and the special character EOF is 0xff (255). You can use any Brainfuck compiler meeting these criteria.

For more details, run ./bf.py -h

Plan

For now, my goal is to be able to run C code on that CPU, because C is the most commonly used programming language.

I think the best idea is to start by creating a virtual machine able to run a higher level language, such as a RISC Assembly language. Indeed, Brainfuck is way to low level: I want to be able to handle pointers, but there is no easy way in Brainfuck to get the byte at a specific address. That's why I'm building a virtual machine with an infinite table acting as a Random-access memory, based on the idea of INSHAME: Memory efficient Brainfuck tables. The virtual machine will use the Von Neumann architecture, putting the program and data in the same memory.

Brainfuck virtual machine

I am currently working on a virtual machine written in Brainfuck and able to run a simple assembly language.

brainfuck-cpu's People

Contributors

arthaud avatar

Watchers

 avatar

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.