Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maxencebonamy/brainfuck-interpreter
Brainfuck is a programming language containing just 8 instructions, each a character. This software is an interpreter that lets you execute a program written in Brainfuck.
https://github.com/maxencebonamy/brainfuck-interpreter
brainfuck brainfuck-interpreter cpp interpreter xmake
Last synced: 16 days ago
JSON representation
Brainfuck is a programming language containing just 8 instructions, each a character. This software is an interpreter that lets you execute a program written in Brainfuck.
- Host: GitHub
- URL: https://github.com/maxencebonamy/brainfuck-interpreter
- Owner: maxencebonamy
- License: mit
- Created: 2022-11-20T15:28:30.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-08T09:36:17.000Z (over 1 year ago)
- Last Synced: 2024-10-24T13:58:57.891Z (3 months ago)
- Topics: brainfuck, brainfuck-interpreter, cpp, interpreter, xmake
- Language: C++
- Homepage:
- Size: 13.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Brainfuck is a programming language containing just 8 instructions, each a character. This software is an interpreter that lets you execute a program written in Brainfuck.
We have an array of cells, each able to store 8 bits, i.e. an unsigned number between and including 255. Next, a pointer will point to a cell in the array (the first by default). This array will in fact represent memory throughout program execution.
The 8 instructions used are as follows:
- **`>`:** move pointer left
- **`<`:** shift pointer to the right
- **`-`:** decrement pointer value
- **`+`:** increment pointer value
- **`.`:** display pointer value as character
- **`,`:** user input of pointer value
- **`[`:** start of an scope
- **`]`:** end of an scope: return to the beginning if the pointed value is non-zero
### Launch the software:
1. Click on the Releases button on the right and select the **latest version**.
2. Download the **.zip** archive and extract the files.
3. Open a terminal from the folder **Brainfuck-Interpreter** and run the folowwing command:
```
./Brainfuck-Interpreter.exe examples/hello_world.bf
```### Compile:
> [!NOTE]
> *Prerequisites:*
> - [x] *Git must be installed on your computer. If not, click here.*
> - [x] *Xmake must be installed on your computer, if not, click here.*1. **Clone** the repository on your computer. To do this, open a terminal in the folder of your choice and run the following command:
```
git clone https://github.com/maxencebonamy/Brainfuck-Interpreter
```2. **Navigate** inside the folder you've just cloned with the following command:
```
cd Brainfuck-Interpreter
```3. **Compile** the project with the following command:
```
xmake
```4. **Run** the executable with this command:
```
xmake run main examples/hello_world.bf
```
### A few rules to follow when writing your program:
- The format of a Brainfuck file is `.bf` (you can actually use any format you like).
- You can write comments anywhere in the file, but be careful not to include any characters corresponding to instructions.
- The program will start to be interpreted from the first `#` character. This means that you have a text zone before this character, where you can write whatever you like, even with characters corresponding to instructions.
- There's already an example program `hello_world.bf` in the `examples` folder, which you can of course use as a basis for your own.