Skip to content

naecoo/brainfuck-compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

brainfuck-compiler

Compiler Brainfuck to Javascript

demo

Install

npm install bf-compiler

Command line

bf-compile -i source.txt -o result.js

// or pass source code directly
br-compile -s '++--..><[]' -o result.js

Javascript API

import { compiler } from 'bf-compiler';
// using `require` in node.js

const result = compiler(source);
// pure compile result
result.compiler;        
// compile result and preset function       
result.code;
// Brainfuck tokens
result.tokens;
// Brainfuck ast
result.ast;
// Javascript ast
result.javascriptAst;

Reference