Skip to content

Instantly share code, notes, and snippets.

@rdebath
Forked from ELLIOTTCABLE/hello_world.bewbs
Last active August 29, 2015 14:05
Show Gist options
  • Save rdebath/12498c2c798a71d59f59 to your computer and use it in GitHub Desktop.
Save rdebath/12498c2c798a71d59f59 to your computer and use it in GitHub Desktop.
%c=qw(XX $p++ XZ $p-- XY D++ YX D-- ZY D&=255;while(D){ YZ D&=255;} YY print+chrD ZZ D=ord(getc) ZX print+join(",",@b),"\n");
$/=$,;$_=<>;s/[XYZ]//g;s/\(\.\)/X/g;s/\[\.\]/Y/g;s/{\.}/Z/g;s/[^XYZ]//g;s/../$c{$&}; /g;s[D]'$b[$p]'g;eval;
=begin comment
/* From: https://gist.github.com/ELLIOTTCABLE/402586 */
/* I wrote “Hello, world!” for whatever mad, mad genius wrote this version of Brainfuck:
http://pastie.org/private/siw6uoan1cd6shuao7r8hw (dead link)
*/
(.)[.] (.)[.] (.)[.] (.)[.] (.)[.] (.)[.] (.)[.] (.)[.] (.)[.] (.)[.] {.}[.] (.)(.) (.)[.] (.)[.] (.)[.] (.)[.]
(.)[.] (.)[.] (.)[.] (.)(.) (.)[.] (.)[.] (.)[.] (.)[.] (.)[.] (.)[.] (.)[.] (.)[.] (.)[.] (.)[.] (.)(.) (.)[.]
(.)[.] (.)[.] (.)(.) (.)[.] (.){.} (.){.} (.){.} (.){.} [.](.) [.]{.} (.)(.) (.)[.] (.)[.] [.][.] (.)(.) (.)[.]
[.][.] (.)[.] (.)[.] (.)[.] (.)[.] (.)[.] (.)[.] (.)[.] [.][.] [.][.] (.)[.] (.)[.] (.)[.] [.][.] (.)(.) (.)[.]
(.)[.] [.][.] (.){.} (.){.} (.)[.] (.)[.] (.)[.] (.)[.] (.)[.] (.)[.] (.)[.] (.)[.] (.)[.] (.)[.] (.)[.] (.)[.]
(.)[.] (.)[.] (.)[.] [.][.] (.)(.) [.][.] (.)[.] (.)[.] (.)[.] [.][.] [.](.) [.](.) [.](.) [.](.) [.](.) [.](.)
[.][.] [.](.) [.](.) [.](.) [.](.) [.](.) [.](.) [.](.) [.](.) [.][.] (.)(.) (.)[.] [.][.] (.)(.) [.][.]
#{.}[.][.](.)[.]{.}{.}[.]
# (.)(.) move memory pointer one right
# (.){.} move memory pointer one left
# (.)[.] increase the current cell
# [.](.) decrease the current cell
# [.][.] output the current cell as character
# {.}{.} input a byte to current cell
# [.]{.} jump back to the corresponding start loop
# {.}[.] if the current cell is zero, jump past the corresponding end loop, otherwise continue
# {.}(.) output the current state of the storage tape
#[.]{.}
# See also: http://codegolf.stackexchange.com/questions/84/interpret-brainfuck#answer-933
@rdebath
Copy link
Author

rdebath commented Aug 10, 2014

Now polyglot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment