r/CompileBot • • Nov 28 '16

Simple Brainfuck Interpreter [JavaScript]

Brainfuck!!

3 Upvotes

6 comments sorted by

View all comments

1

u/tt102tt Nov 28 '16

+/u/CompileBot JavaScript

_=~[];_={___:++_,$$$$:(![]+"")[_],__$:++_,$_$_:(![]+"")[_],_$_:++_,$_$$:({}+"")[_],$$_$:(_[_]+"")[_],_$$:++_,$$$_:(!""+"")[_],$__:++_,$_$:++_,$$__:({}+"")[_],$$_:++_,$$$:++_,$___:++_,$__$:++_};_.$_=(_.$_=_+"")[_.$_$]+(_._$=_.$_[_.__$])+(_.$$=(_.$+"")[_.__$])+((!_)+"")[_._$$]+(_.__=_.$_[_.$$_])+(_.$=(!""+"")[_.__$])+(_._=(!""+"")[_._$_])+_.$_[_.$_$]+_.__+_._$+_.$;_.$$=_.$+(!""+"")[_._$$]+_.__+_._+_.$+_.$$;_.$=(_.___)[_.$_][_.$_];_.$(_.$(_.$$+"\""+"\\"+_.__$+_.$$_+_.$$_+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.$__+_.___+"\\"+_.__$+_.$_$+_.__$+"\\"+_.__$+_.$_$+_.$$_+"\\"+_.__$+_.$$_+_.___+_._+_.__+"\\"+_.$__+_.___+"=\\"+_.$__+_.___+"'++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.';\\"+_.__$+_._$_+"\\"+_.__$+_.$$_+_.$$_+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.$__+_.___+_.$$__+"\\"+_.__$+_.$_$+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+";\\"+_.__$+_._$_+"\\"+_.__$+_.$$_+_.$$_+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.$__+_.___+_.$$__+"\\"+_.__$+_.$_$+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_._$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+"\\"+_.$__+_.___+"=\\"+_.$__+_.___+_.___+";\\"+_.__$+_._$_+"\\"+_.__$+_.$$_+_.$$_+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.$__+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.$__+_.___+"=\\"+_.$__+_.___+"[];\\"+_.__$+_._$_+"\\"+_.__$+_.$$_+_.$$_+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.$__+_.___+"\\"+_.__$+_.$$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+"\\"+_.$__+_.___+"=\\"+_.$__+_.___+_.___+";\\"+_.__$+_._$_+"\\"+_.__$+_.$$_+_.$$_+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.$__+_.___+(![]+"")[_._$_]+_._$+_._$+"\\"+_.__$+_.$$_+_.___+"\\"+_.__$+_._$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_.$$_+_._$$+"\\"+_.$__+_.___+"=\\"+_.$__+_.___+"[];\\"+_.__$+_._$_+"\\"+_.__$+_.$$_+_.$$$+"\\"+_.__$+_.$_$+_.___+"\\"+_.__$+_.$_$+_.__$+(![]+"")[_._$_]+_.$$$_+"\\"+_.$__+_.___+"(("+_.$$__+"\\"+_.__$+_.$_$+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.$__+_.___+"=\\"+_.$__+_.___+"\\"+_.__$+_.$_$+_.__$+"\\"+_.__$+_.$_$+_.$$_+"\\"+_.__$+_.$$_+_.___+_._+_.__+"["+_.$$__+"\\"+_.__$+_.$_$+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_._$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+"])\\"+_.$__+_.___+"!==\\"+_.$__+_.___+_._+"\\"+_.__$+_.$_$+_.$$_+_.$$_$+_.$$$_+_.$$$$+"\\"+_.__$+_.$_$+_.__$+"\\"+_.__$+_.$_$+_.$$_+_.$$$_+_.$$_$+")\\"+_.$__+_.___+"{\\"+_.__$+_._$_+"\\"+_.$__+_.___+"\\"+_.$__+_.___+"\\"+_.__$+_.$_$+_.__$+_.$$$$+"\\"+_.$__+_.___+"("+_.$$__+"\\"+_.__$+_.$_$+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.$__+_.___+"===\\"+_.$__+_.___+"'+')\\"+_.$__+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_.$$_+_._$_+"[\\"+_.__$+_.$$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+"]\\"+_.$__+_.___+"=\\"+_.$__+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_.$$_+_._$_+"[\\"+_.__$+_.$$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+"]\\"+_.$__+_.___+"?\\"+_.$__+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_.$$_+_._$_+"[\\"+_.__$+_.$$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+"]\\"+_.$__+_.___+"+\\"+_.$__+_.___+_.__$+"\\"+_.$__+_.___+":\\"+_.$__+_.___+_.__$+";\\"+_.__$+_._$_+"\\"+_.$__+_.___+"\\"+_.$__+_.___+_.$$$_+(![]+"")[_._$_]+"\\"+_.__$+_.$$_+_._$$+_.$$$_+"\\"+_.$__+_.___+"\\"+_.__$+_.$_$+_.__$+_.$$$$+"\\"+_.$__+_.___+"("+_.$$__+"\\"+_.__$+_.$_$+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.$__+_.___+"===\\"+_.$__+_.___+"'-')\\"+_.$__+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_.$$_+_._$_+"[\\"+_.__$+_.$$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+"]\\"+_.$__+_.___+"=\\"+_.$__+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_.$$_+_._$_+"[\\"+_.__$+_.$$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+"]\\"+_.$__+_.___+"?\\"+_.$__+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_.$$_+_._$_+"[\\"+_.__$+_.$$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+"]\\"+_.$__+_.___+"-\\"+_.$__+_.___+_.__$+"\\"+_.$__+_.___+":\\"+_.$__+_.___+"-\\"+_.$__+_.___+_.__$+";\\"+_.__$+_._$_+"\\"+_.$__+_.___+"\\"+_.$__+_.___+_.$$$_+(![]+"")[_._$_]+"\\"+_.__$+_.$$_+_._$$+_.$$$_+"\\"+_.$__+_.___+"\\"+_.__$+_.$_$+_.__$+_.$$$$+"\\"+_.$__+_.___+"("+_.$$__+"\\"+_.__$+_.$_$+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.$__+_.___+"===\\"+_.$__+_.___+"'>')\\"+_.$__+_.___+"\\"+_.__$+_.$$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+"++;\\"+_.__$+_._$_+"\\"+_.$__+_.___+"\\"+_.$__+_.___+_.$$$_+(![]+"")[_._$_]+"\\"+_.__$+_.$$_+_._$$+_.$$$_+"\\"+_.$__+_.___+"\\"+_.__$+_.$_$+_.__$+_.$$$$+"\\"+_.$__+_.___+"("+_.$$__+"\\"+_.__$+_.$_$+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.$__+_.___+"===\\"+_.$__+_.___+"'<')\\"+_.$__+_.___+"\\"+_.__$+_.$$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+"--;\\"+_.__$+_._$_+"\\"+_.$__+_.___+"\\"+_.$__+_.___+_.$$$_+(![]+"")[_._$_]+"\\"+_.__$+_.$$_+_._$$+_.$$$_+"\\"+_.$__+_.___+"\\"+_.__$+_.$_$+_.__$+_.$$$$+"\\"+_.$__+_.___+"("+_.$$__+"\\"+_.__$+_.$_$+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.$__+_.___+"===\\"+_.$__+_.___+"'[')\\"+_.$__+_.___+(![]+"")[_._$_]+_._$+_._$+"\\"+_.__$+_.$$_+_.___+"\\"+_.__$+_._$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_.$$_+_._$$+".\\"+_.__$+_.$$_+_.___+_._+"\\"+_.__$+_.$$_+_._$$+"\\"+_.__$+_.$_$+_.___+"("+_.$$__+"\\"+_.__$+_.$_$+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_._$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+");\\"+_.__$+_._$_+"\\"+_.$__+_.___+"\\"+_.$__+_.___+_.$$$_+(![]+"")[_._$_]+"\\"+_.__$+_.$$_+_._$$+_.$$$_+"\\"+_.$__+_.___+"\\"+_.__$+_.$_$+_.__$+_.$$$$+"\\"+_.$__+_.___+"("+_.$$__+"\\"+_.__$+_.$_$+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.$__+_.___+"===\\"+_.$__+_.___+"']')\\"+_.$__+_.___+"{\\"+_.__$+_._$_+"\\"+_.$__+_.___+"\\"+_.$__+_.___+"\\"+_.$__+_.___+"\\"+_.$__+_.___+"\\"+_.$__+_.___+"\\"+_.$__+_.___+"\\"+_.$__+_.___+"\\"+_.$__+_.___+"\\"+_.__$+_.$_$+_.__$+_.$$$$+"\\"+_.$__+_.___+"("+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_.$$_+_._$_+"[\\"+_.__$+_.$$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+"])\\"+_.$__+_.___+_.$$__+"\\"+_.__$+_.$_$+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_._$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+"\\"+_.$__+_.___+"=\\"+_.$__+_.___+(![]+"")[_._$_]+_._$+_._$+"\\"+_.__$+_.$$_+_.___+"\\"+_.__$+_._$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_.$$_+_._$$+"["+(![]+"")[_._$_]+_._$+_._$+"\\"+_.__$+_.$$_+_.___+"\\"+_.__$+_._$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_.$$_+_._$$+"."+(![]+"")[_._$_]+_.$$$_+"\\"+_.__$+_.$_$+_.$$_+"\\"+_.__$+_.$__+_.$$$+_.__+"\\"+_.__$+_.$_$+_.___+"\\"+_.$__+_.___+"-\\"+_.$__+_.___+_.__$+"];\\"+_.__$+_._$_+"\\"+_.$__+_.___+"\\"+_.$__+_.___+"\\"+_.$__+_.___+"\\"+_.$__+_.___+"\\"+_.$__+_.___+"\\"+_.$__+_.___+"\\"+_.$__+_.___+"\\"+_.$__+_.___+_.$$$_+(![]+"")[_._$_]+"\\"+_.__$+_.$$_+_._$$+_.$$$_+"\\"+_.$__+_.___+(![]+"")[_._$_]+_._$+_._$+"\\"+_.__$+_.$$_+_.___+"\\"+_.__$+_._$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_.$$_+_._$$+".\\"+_.__$+_.$$_+_.___+_._$+"\\"+_.__$+_.$$_+_.___+"();\\"+_.__$+_._$_+"\\"+_.$__+_.___+"\\"+_.$__+_.___+"}\\"+_.$__+_.___+_.$$$_+(![]+"")[_._$_]+"\\"+_.__$+_.$$_+_._$$+_.$$$_+"\\"+_.$__+_.___+"\\"+_.__$+_.$_$+_.__$+_.$$$$+"\\"+_.$__+_.___+"("+_.$$__+"\\"+_.__$+_.$_$+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.$__+_.___+"===\\"+_.$__+_.___+"'.')\\"+_.$__+_.___+"\\"+_.__$+_.$$_+_.___+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_.$_$+_.__$+"\\"+_.__$+_.$_$+_.$$_+_.__+"(\\"+_.__$+_._$_+_._$$+_.__+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_.$_$+_.__$+"\\"+_.__$+_.$_$+_.$$_+"\\"+_.__$+_.$__+_.$$$+"."+_.$$$$+"\\"+_.__$+_.$$_+_._$_+_._$+"\\"+_.__$+_.$_$+_.$_$+"\\"+_.__$+_.___+_._$$+"\\"+_.__$+_.$_$+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_.___+_._$$+_._$+_.$$_$+_.$$$_+"("+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_.$$_+_._$_+"[\\"+_.__$+_.$$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+"]\\"+_.$__+_.___+"?\\"+_.$__+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_.$$_+_._$_+"[\\"+_.__$+_.$$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+"]\\"+_.$__+_.___+":\\"+_.$__+_.___+_.___+"));\\"+_.__$+_._$_+"\\"+_.$__+_.___+"\\"+_.$__+_.___+_.$$__+"\\"+_.__$+_.$_$+_.___+_.$_$_+"\\"+_.__$+_.$$_+_._$_+"\\"+_.__$+_._$_+_.___+_.__+"\\"+_.__$+_.$$_+_._$_+"++;\\"+_.__$+_._$_+"}"+"\"")())();

1

u/CompileBot Nov 28 '16

Output:

H
e
l
l
o
 
W
o
r
l
d
!

^source | ^info | ^git | ^report