Skip to content

AuthentiCuber/brainfuckery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brainfuckery

A collection of simple Brainfuck interpreters written in a variety of languages

Why?

Mainly an excuse to get some experience in a bunch of languages. Brainfuck interpreters are great for this because they are relatively simple while utilising a decent range of a languages features. Such features include:

  • (file) IO
  • structs/enums/objects to represent tokens
  • several data types: strings, characters, arrays, integers/bytes
  • control structures: different kinds of loops, if, switch-case, pattern matching
  • a simple CLI

Approach

The idea is to keep these implementations as simple as possible while implementing all of BFs features. This means I will not be implementing any fancy optimisations or tricks. I am implementing these interpreters in the most straightforward way I can think of. The general design is as follows:

.bf file -> tokenisation -> parsing -> interpreter -> output

The tokeniser converts the plaintext input into a list of symbolic tokens, ignoring any characters that are not one of Brainfuck's 8 commands. The parser collapses any repeated data or data-pointer commands into singular commands, and also associates matching bracket pairs with each other. Finally, the interpreter executes this intermediate representation.

Inspired by Tsoding's BF JIT compiler. (see also his VOD of its development)

Languages

  • python
  • C
  • Dart
  • Haskell
  • Javascript

more to come ...

About

A collection of simple Brainfuck interpreters written in a variety of languages

Resources

License

Stars

Watchers

Forks

Contributors