Information Technologies

Brainfuck

Brainfuck has one of the smallest compilers among all other software languages. That’s why it’s known as one of the smallest software languages in the world(for now :).

Basically it has 8 program instructions as the following:

Instructions of Brainfuck

Brainfuck Command C equivalent
(Program Start) char array[30000] = {0}; char *ptr = &array[0];
> ++ptr;
< –ptr;
+ ++*ptr;
- –*ptr;
. putchar(*ptr);
, *ptr=getchar();
[ while (*ptr) {
] }

A Sample Program

Note: Any online compiler can be used to execute.

//Initialize 27 characters for the ASCII message.
+++++ +++++ +++++ +
[
    >+++++ >+++++ >+++++ >+++++ >+++++ >+++++
    >+++++ >+++++ >+++++ >+++++ >+++++ >+++++
    >+++++ >+++++ >+++++ >+++++ >+++++ >+++++
    >+++++ >+++++ >+++++ >+++++ >+++++ >+++++
    >+++++ >+++++ >+++++
<<<<< <<<<< <<<<< <<<<< <<<<< <<-
]

//Set the specific ASCII characters.
>+++++ ++++
>-
>+++++
>++++++++++++++++
>++
>-----------
>------------------------------------------------
>+++
>++++
>-------
>----
>----
>------------------------------------------------
>---------------
>----
>-------
>++++++
>-----------
>---------------------
>---------------------------------------
>------------------------------------------------
>-----------
>--
>------
>-
>+++++++++
>-----------------------------------------------

//First cell of the message.
<<<<< <<<<< <<<<< <<<<< <<<<< <<- 

//Print out.
[
    >.
]

References

https://en.wikipedia.org/wiki/Brainfuck
https://www.jdoodle.com/execute-brainfuck-online/