Skip to content

markx86/bf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bf

a simple brainfuck interpreter

Note

This is a project I made in an afternoon, while at home with a fever.
If you any see obvious bugs, now you know why.

bf is a simple brainfuck interpreter that can read a program from either stdin or a file. It supports programs up to 32KB in size.

The source code comes in two languages:

  • C: this is the first version I made and it was a prototype for the second one
  • x86-64 assembly: this is the second version, and it limits itself to using only the original x86 registers (*ax, *bx, *cx, *dx, *di, *si), which should make it easier to port to 32-bit, if I ever want to :^)

usage

$ bf [INPUT-FILE]

where INPUT-FILE is an optional arguments, and is a valid path to a file containing a valid brainfuck program. If no argument is provided or if INPUT-FILE is -, bf will read the program from standard input.

Note

The program must under 32KB in size.

building

To build the C version run:

$ make c

To build the x86-64 assembly version run:

$ make asm

Warning

Both build targets will produce an executable called bf and will overwrite any existing file with that name in the same directory as the makefile.

About

a simple brainfuck interpreter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published