Browse Source

docs(brainfuck) correct grammar

pull/1183/head
davhojt 2 years ago committed by Dav Hojt
parent
commit
ebab4a3f8c
  1. 24
      subjects/brainfuck/README.md

24
subjects/brainfuck/README.md

@ -1,21 +1,23 @@
## brainfuck ## brainfuck
> Esoteric programming languages (esolang) are designed to test the boundaries of computer programming design, as proofs of concept, as software art, as a hacking interface or simply as a joke. One such esoteric language is `Brainfuck`. It was created by Urban Müller in 1993. It is a minimalist language consisting of 8 simple commands. It is Turing complete, but is not intended for practical use. It exists to amuse and challenge programmers.
### Instructions ### Instructions
Write a `Brainfuck` interpreter program. Write a `Brainfuck` interpreter program.
The source code will be given as first parameter.
The code will always be valid, with less than 4096 operations.
`Brainfuck` is a minimalist language. It consists of an array of bytes (in this exercice 2048 bytes) all initialized with zero, and with a pointer to its first byte.
Every operator consists of a single character : The source code will be given as the first parameter, and will always be valid with fewer than 4096 operations.
- '>' increment the pointer Your `Brainfuck` interpreter will consist of an array of 2048 bytes, all initialized to 0, with a pointer to the first byte.
- '<' decrement the pointer
- '+' increment the pointed byte Every operator consists of a single character:
- '-' decrement the pointed byte - `>`: increment the pointer.
- '.' print the pointed byte on standard output - `<`: decrement the pointer.
- '[' go to the matching ']' if the pointed byte is 0 (loop start) - `+`: increment the pointed byte.
- ']' go to the matching '[' if the pointed byte is not 0 (loop end) - `-`: decrement the pointed byte.
- `.`: print the pointed byte to the standard output.
- `[`: if the pointed byte is 0, then instead of moving onto the next command, skip to the command after the matching `]`.
- `]`: if the pointed byte is **not** 0, then instead of moving onto the next command, move back to the command after the matching `[`.
Any other character is a comment. Any other character is a comment.

Loading…
Cancel
Save