Skip to content

Axorax/bfcomp.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bfcomp.js

Compile and convert text to brainfuck code

⚙️ Installation

npm i bfcomp

CDN Links:

📖 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);

Support me on Patreon - Check out my socials