pwseo/brainfuck-c

Created Feb 20, 2021 · View the pwseo/brainfuck-c repository page

Brainfuck interpreter written in C99

Want this for your repo?

Render a free sample of any GitHub repo in seconds.

Visualize your own →

Contributors

1

Lines of Code

100

From

Dec 17, 2016

To

Jan 25, 2021

About pwseo/brainfuck-c

This is a Brainfuck interpreter implemented in C99 that executes Brainfuck source code files passed as command-line arguments. Rather than directly interpreting the esoteric language's operations, the program first converts the source code into an optimized internal representation, which improves performance during execution.

The interpreter includes several optimization passes that simplify the compiled representation before running. It recognizes common patterns like loops that only increment or decrement a cell and replaces them with direct zero-assignment operations. Additionally, it collapses sequences of consecutive increment, decrement, and pointer movement instructions into single operations that perform the equivalent arithmetic and memory manipulations more efficiently.

Share this video