-
Notifications
You must be signed in to change notification settings - Fork 0
ahorn/bf-interpreter
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
License: GPL Author: A. Horn Description: BF virtual machine written in C Installation: sudo make install BF 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'
About
BF virtual machine written in C
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published