This project is a Brainfuck compiler written mostly in assembly, capable of parsing Brainfuck code and printing its output to standard output or to file.
Brainfuck (often stylized as BF) is an extremely small yet Turing-complete PL.
You can find brainfuck wiki right here.
The compler reads and executes Brainfuck code directly from a file.
- Input file:
code.bf— contains your Brainfuck program. - Optional input:
input.txt— contains input characters to be read by the Brainfuck,command. - Output file:
output.txt— the result of program execution is written here.- If
output.txtalready exists, it will be overwritten. - If the program requests input but
input.txtis missing, execution will fail with an error.
- If
- Put your Brainfuck program in a file named
code.bf. - Add input data in
input.txtit your code requires it. - Run the compiler
main.exe.
Files:
- code.bf - brainfuck source code
- input.txt - some input args
- output.txt - some output artifacts
| Command | Symbol | Description |
|---|---|---|
| Increment Pointer | > |
Move the memory pointer to the right (next cell). |
| Decrement Pointer | < |
Move the memory pointer to the left (previous cell). |
| Increment Byte | + |
Increase the byte value at the current cell by 1. |
| Decrement Byte | - |
Decrease the byte value at the current cell by 1. |
| Output Byte | . |
Print the character corresponding to the byte at the current cell. |
| Input Byte | , |
Read one character from input and store it in the current cell. |
| Loop Start | [ |
If the current cell value is 0, jump forward to the command after the matching ]. |
| Loop End | ] |
If the current cell value is nonzero, jump back to the command after the matching [. |
-
The compiler is primarily written in assembly, emphasizing performance and low-level control. But the main purpose it just make some fun during a development process.
-
Designed for educational and experimental use.