{"library":"node.bf","title":"node.bf","description":"Node.bf is a JavaScript transpiler that compiles Node.js modules written in Brainfuck, an esoteric Turing-complete language using only characters +-<>[].,. Version 0.1.0 is the current stable release; the project appears to be in early development with no frequent updates. Unlike other Brainfuck interpreters or compilers, node.bf integrates with Node.js module system, allowing .bf files to be compiled into JavaScript modules that export a function. It uses Jison for parser generation and supports Webpack loaders for direct import of .bf files.","language":"javascript","status":"active","last_verified":"Fri May 01","install":{"commands":["npm install node.bf"],"cli":null},"imports":["import myModule from './path/to/module.bf';","import { compile } from 'node.bf';","import { run } from 'node.bf';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { compile } from 'node.bf';\nconst fs = require('fs');\nconst path = require('path');\n\nconst bfSource = '++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.';\n\n// Compile the Brainfuck source to a JavaScript function\ntranspile(bfSource).then(jsCode => {\n  // Create a Node module from the compiled code\n  const modulePath = path.join(process.cwd(), 'hello.bf.js');\n  fs.writeFileSync(modulePath, `module.exports = function(input) { ${jsCode} };`);\n  const helloWorld = require('./hello.bf.js');\n  console.log(helloWorld(''));\n});\n\nfunction transpile(source) {\n  return new Promise((resolve, reject) => {\n    compile(source, (err, result) => {\n      if (err) reject(err);\n      else resolve(result);\n    });\n  });\n}","lang":"javascript","description":"Shows how to compile a Brainfuck 'Hello World' program and use the resulting function with Node.js modules.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}