GitXplorerGitXplorer
a

brainfuck-cpu

public
3 stars
2 forks
0 issues

Commits

List of commits on branch master.
Unverified
5ab2ff82ff8ee06975380350eb7c26f9ec5e761a

Fetch, decode and execute instructions (nop and exit)

aarthaud committed 9 years ago
Unverified
a75d64d698428dafd1e0a4ec812e71c47b6e62ea

Fetch the next instruction

aarthaud committed 9 years ago
Unverified
77e99baa6e4e102d5e7f4ad814c92cd6109c21c5

Work on the brainfuck virtual machine

aarthaud committed 9 years ago
Unverified
afb25449aed30e0fe04ed8380c6142ded1772e9f

Add incrementation of 4 bytes

aarthaud committed 9 years ago
Unverified
4d4695b4fbe564af7ed0fa15a7d343176e8d51d7

Rename some variables

aarthaud committed 9 years ago
Unverified
b899f3425f04462d8901f27e840af103e5d173cc

brainfuck virtual machine: registers management

aarthaud committed 9 years ago

README

The README file for this repository.

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.