CoffeeFuck
A BrainFuck interpreter written in CoffeeScript.
Installation
npm install --save coffeefuck
Usage
const coffeefuck = require('coffeefuck');
const result = coffeefuck('++++++++[->+++++<]');
console.log(result.memory);
Return
const {
output,
memory,
timeout,
time,
} = coffeefuck('++[->+<]');
Options
options.length
Defines the maximal length of memory.
(default: 2**32-1)
const result = coffeefuck('+>+>+>+>+>+', { length: 3 });
console.log(result);
options.size
Defines the size of the bytes in the memory.
(default: 2**8)
const result = coffeefuck('-', { size: 2**16 });
console.log(result);
options.timeout
Stops running the BrainFuck interpretation after a specific time in milliseconds.
(default: Infinity)
const result = coffeefuck('+[]', { timeout: 500 });
console.log(result);
options.inputs
If you know what BrainFuck is, then you know for what this is for.
(default: [])
const result = coffeefuck(',[->+<],', { inputs: [69,21] });
console.log(result);
options.async
Returns a promise instead of running synchronously.
(default: false)
Note: This makes the interpretation slower.
const result = await coffeefuck('+[>+[>+[+]<+]+[+]<+]', { async: true });
console.log(result);