Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ahorn/bf-interpreter
BF virtual machine written in C
https://github.com/ahorn/bf-interpreter
Last synced: 2 months ago
JSON representation
BF virtual machine written in C
- Host: GitHub
- URL: https://github.com/ahorn/bf-interpreter
- Owner: ahorn
- Created: 2011-06-04T08:58:51.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2013-12-01T19:10:23.000Z (about 11 years ago)
- Last Synced: 2024-04-24T15:34:33.344Z (9 months ago)
- Language: C
- Homepage:
- Size: 105 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
- AwesomeInterpreter - bf-interpreter
README
License: GPL
Author: A. Horn
Description: BF virtual machine written in C
Installation: sudo make installBF commands:
> increment the data pointer (to point to the next cell to the right).
< decrement the data pointer (to point to the next cell to the left).
+ increment (increase by one) the byte at the data pointer.
- decrement (decrease by one) the byte at the data pointer.
. output the value of the byte at the data pointer.
, accept one byte of input, storing its value in the byte at the data pointer.
[ if the byte at the data pointer is zero, then instead of moving the instruction
pointer forward to the next command, jump it forward to the command after
the matching ] command*.
] if the byte at the data pointer is nonzero, then instead of moving the instruction
pointer forward to the next command, jump it back to the command after the
matching [ command*.Example:
+++++ +++++ // 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'