|
Language::BF - BF virtual machine in perl |
Language::BF - BF virtual machine in perl
my $bf = Language::BF->new(<<EOC); ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<< +++++++++++++++.>.+++.------.--------.>+.>. EOC $bf->run; print $bf->output; # "Hello World!\n";
Language::BF is a straightforward (rather boring) implementation of Brainfuck programming language.
Language::BF is a OOP module that offers following methods
new($filename)code($code)parse($code)$bf->reset
run([$mode])$mode to non-zero value, it runs as an iterpreter.
as_source is that this one adds interface to STDIN/STDOUT so it can
be directly fed back to perl.
perl -MLanguage::BF \
-e 'print Language::BF->new_from_file(shift)->as_perl' source.bf\
| perl
is equivalent to running source.bf.
None by default.
http://en.wikipedia.org/wiki/Brainfuck
Dan Kogai, <dankogai@dan.co.jp>
Copyright (C) 2006 by Dan Kogai
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
|
Language::BF - BF virtual machine in perl |