Blablafuck

From Esolang
Jump to navigation Jump to search

Blablafuck is an esoteric language based on Extended Brainfuck, in which commands are most used english words.

Commands

Brainfuck Extended Command Word
> the
< of
+ and
- to
. a
, in
[ for
] is
@ on
$ that
! by
} this
{ with
~ i
^ you
& it
| not
? or
) be
( are
* from
/ at
= as
_ your
% all
X have
x new
M more
m an
L was
l we
: will
0 home
1 can
2 us
3 about
4 if
5 page
6 my
7 has
8 search
9 free
A but
B our
C one
D other
E do
F no
# information/info

Dots at the end and capitals at the start are mandatory.

Hello World

Extended Brainfuck 3 Hello World code:

 >5--------.7-----------.+++++++..+++.<2.5+++++++.>.+++.------.--------.2+.

Is equivalent to:

 The page to to to to to to to to a has and and and and and and and a a and and and a of us a page and and and and and and and a the a and and and a to to to to to to a to to to to to to to to a us and a.

Compiler to Extended Brainfuck

def bbf_to_ebf(code):
  assert code[0].isupper() and code[1:-1].islower() and code[-1] == ".", "SyntaxError"
  code = code[:-1].lower()
  _s = ">the <of +and -to .a ,in [for ]is @on $that !by }this {with ~i ^you &it |not ?or )be (are *from /at =as _your %all Xhave xnew Mmore man Lwas lwe :will 0home 1can 2us 3about 4if 5page 6my 7has 8search 9free Abut Bour Cone Dother Edo Fno #information #info"
  cm = {s[1:]: s[0] for s in _s.split()}
  r = ""
  for w in code.split():
    r += cm.get(w, "")

See also