picofuck v1.0.0
picofuck
Perhaps the smallest Javascript brainfuck interpreter
picofuck
is a tiny Javascript brainfuck interpreter.
Usage
var bf = require("picofuck")
bf("+++[>++++++++++<-]>+++."); // Returns "!"
Why
Why not?
This library is also an open codegolf challenge. Please feel free to submit pull requests if you're able to make the code even shorter!
Install, Build & Test
To install the package, use the standard NPM install command:
npm install picofuck
The package is hand-written, minified Javascript; therefore, no build process is required, and you can directly edit and execute the source!
An NPM script has been created for simplicity when running tests, which can be run from the command line as shown below:
npm test
picofuck uses the Tape library for testing.
Content Delivery Network (CDN)
The picofuck library can be imported via unpkg as shown below:
<script type="application/javascript">var module={};</script>
<script src="https://unpkg.com/picofuck/index.js"></script>
<script type="application/javascript">
var bf = module.exports;
// Library is imported as `bf`!
</script>
Be aware that picofuck is a CommonJS module and therefore uses
module.exports
; before importing the script, you will need to define module
or use a CommonJS-compatible module loader.
License
Please see the LICENSE
file for license information.
6 years ago