https://github.com/codella/noofakku
A Ruby gem providing a brainfuck language interpreter
https://github.com/codella/noofakku
brainfuck brainfuck-interpreter ruby ruby-on-rails
Last synced: 3 months ago
JSON representation
A Ruby gem providing a brainfuck language interpreter
- Host: GitHub
- URL: https://github.com/codella/noofakku
- Owner: codella
- Created: 2017-08-26T08:37:50.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-08-26T08:38:06.000Z (over 7 years ago)
- Last Synced: 2025-02-15T11:34:05.244Z (3 months ago)
- Topics: brainfuck, brainfuck-interpreter, ruby, ruby-on-rails
- Language: Ruby
- Homepage: https://rubygems.org/gems/noofakku
- Size: 69.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Usage Samples
=============```ruby
require 'noofakku'input = -> { 0 }
produced = ''
output = ->value { produced << value }# will print "Hello World!\n"
program = '++++++++++[>+++++++>++++++++++>+++>'
program << '+<<<<-]>++.>+.+++++++..+++.>++.<<++'
program << '+++++++++++++.>.+++.------.--------.>+.>.'Noofakku::VM.start(program, input, output)
p produced #=> "Hello World!\n"
``````ruby
require 'noofakku'to_be_sorted = [5, 3, 2, 6, 0].each
input = -> { to_be_sorted.next }
produced = []
output = ->value { produced << value }# will sort the zero-ended array in input
program = '>>,[>>,]<< [[-<+<]>[>[>>]<[.[-]<[[>>+<<-]<]>>]>]<<]'Noofakku::VM.start(program, input, output)
p produced #=> [2, 3, 5, 6]
```Other usage samples can be found in https://github.com/mcodella/noofakku/blob/master/test/noofakku_smoke_test.rb