Skip to content

Brainfuck interpreter in AT&T syntax x86 Assembly.

Notifications You must be signed in to change notification settings

totomanov/bf-interp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

bf-interp

Brainfuck interpreter in AT&T syntax x86 Assembly. Optimization strategies were gleaned from Mats Linander's blog post. The program was created as a part of the Computer Organisation course at TU Delft.

Running on Linux

  1. Clone this repo in a new directory.
git clone https://github.com/totomanov/bf-interp.git
  1. Assemble the program with GCC.
gcc -no-pie -o brainfuck brainfuck.s
  1. Create a file with brainfuck code. Example helloworld.b:
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
  1. Execute the binary with the file as an argument.
./brainfuck helloworld.b

Debugging

  1. Pass the -g flag to GCC.
gcc -g -no-pie -o brainfuck brainfuck.s
  1. Start the debugger.
gdb ./brainfuck

Benchmarking

To benchmark the interpreter, you can run common benchamrking programs in brainfuck such as hanoi.b or mandelbrot.b. They can be found at this website which also shows the intended output.

Measuring execution time

Measuring the execution time of the interpreter is easily done with the GNU time utility. Simply prepend the execution call with time.

time ./brainfuck mandelbrot.b

About

Brainfuck interpreter in AT&T syntax x86 Assembly.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published