Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/totomanov/bf-interp
Brainfuck interpreter in AT&T syntax x86 Assembly.
https://github.com/totomanov/bf-interp
Last synced: 21 days ago
JSON representation
Brainfuck interpreter in AT&T syntax x86 Assembly.
- Host: GitHub
- URL: https://github.com/totomanov/bf-interp
- Owner: totomanov
- Created: 2020-06-19T06:26:02.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-19T07:14:13.000Z (over 4 years ago)
- Last Synced: 2024-04-14T02:02:41.144Z (7 months ago)
- Language: Assembly
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bf-interp
Brainfuck interpreter in AT&T syntax x86 Assembly. Optimization strategies were gleaned from [Mats Linander's blog post.](http://calmerthanyouare.org/2015/01/07/optimizing-brainfuck.html)
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
```
2. Assemble the program with GCC.
```
gcc -no-pie -o brainfuck brainfuck.s
```
3. Create a file with brainfuck code. Example `helloworld.b`:
``` .b
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
````
4. 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
```
2. 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](https://copy.sh/brainfuck/) 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
```