https://github.com/lukad/bf
bf is a Brainfuck interpreter written in Elixir.
https://github.com/lukad/bf
brainfuck elixir interpreter
Last synced: 2 months ago
JSON representation
bf is a Brainfuck interpreter written in Elixir.
- Host: GitHub
- URL: https://github.com/lukad/bf
- Owner: lukad
- License: mit
- Created: 2017-01-07T18:02:10.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-08-19T18:25:38.000Z (over 5 years ago)
- Last Synced: 2025-02-08T03:11:19.071Z (3 months ago)
- Topics: brainfuck, elixir, interpreter
- Language: Elixir
- Homepage:
- Size: 61.5 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bf
`bf` is a simple [Brainfuck](https://esolangs.org/wiki/brainfuck) interpreter written in Elixir.
## Documentation
Documentation for the latest release is availabe at [hexdocs.pm](https://hexdocs.pm/bf).
## Installation
Automatic installation with mix:
```bash
mix escript.install bf
```Manual installation
```bash
git clone https://github.com/lukad/bf.git
cd bf
MIX_ENV=prod mix do escript.build, escript.install
```## Usage
```bash
$ cat < hello.bf
+++++ +++++ initialize counter (cell #0) to 10
[ use loop to set the next four cells to 70/100/30/10
> +++++ ++ add 7 to cell #1
> +++++ +++++ add 10 to cell #2
> +++ add 3 to cell #3
> + add 1 to cell #4
<<<< - decrement counter (cell #0)
]
> ++ . print 'H'
> + . print 'e'
+++++ ++ . print 'l'
. print 'l'
+++ . print 'o'
> ++ . print ' '
<< +++++ +++++ +++++ . print 'W'
> . print 'o'
+++ . print 'r'
----- - . print 'l'
----- --- . print 'd'
> + . print '!'
> . print '\n'
EOF$ bf hello.bf
Hello World!
```## Interpreter Info
* Cells are 8 bits wide
* Cells wrap around 256
* `255 + 1 = 0`
* `0 - 1 = 255`
* The tape is 30000 cells large
* The tape pointer wraps around 30000
* '0' on STDIN signals EOF