Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hallerpatrick/brainfuck
https://github.com/hallerpatrick/brainfuck
Last synced: 28 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/hallerpatrick/brainfuck
- Owner: HallerPatrick
- License: mit
- Created: 2020-11-28T16:30:26.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-11-29T18:02:18.000Z (about 4 years ago)
- Last Synced: 2024-12-08T18:04:54.714Z (about 1 month ago)
- Language: Go
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Brainfuck Interpreter in Go
My from scratch implementation of a
[Brainfuck](https://en.wikipedia.org/wiki/Brainfuck) Interpreter written in Golang.This 300 line project was meant to teach me some Go and maybe a little bit of interpreter crafting.
## Usage
````bash
go run main.go example/helloworld.b
````This "simple" brainfuck program should print a good old `"Hello World!\n"`
```brainfuck
+++++ +++++ initialize counter (cell #0) to 10
[ set the next four cells to 70, 100, 30 and 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' (H = ASC (72))
> + . print 'e' (e = ASC (101))
+++++ ++ . print 'l'
. print 'l'
+++ . print 'o'> ++ . print ' '
<< +++++ +++++ +++++ . print 'W'
> . print 'o'
+++ . print 'r'
----- - . print 'l'
----- --- . print 'd'
> + . print '!'
> . print '\n'
```