bfcomp
v1.0.0
Published
Compile and convert text to brainfuck code
Downloads
1
Maintainers
Readme
⚙️ Installation
npm i bfcomp
CDN Links:
- https://cdn.jsdelivr.net/npm/[email protected]/bfcomp.js
- https://www.unpkg.com/[email protected]/bfcomp.js
📖 Usage
◎ Import
// ES6
import bfcomp from "bfcomp";
// commonjs
const bfcomp = require("bfcomp");
◎ Compile / To text
const code = "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.";
const text = bfcomp.compile(code);
const text2 = bfcomp.toText(code);
console.log(text); // "Hello World!"
console.log(text2); // "Hello World!"
◎ Run
// code variable declared in the previous example
bfcomp.run(code);
This will console.log()
the compiled BF code.
◎ To code
const code = bfcomp.toCode("Hello!");
console.log(code); // returns BF code
const code = bfcomp.toCode("Hello!");
bfcomp.run(code);