0% found this document useful (0 votes)
55 views

Esoteric Programming

The document discusses two esoteric programming languages: Brainf**k and Whitespace. Brainf**k has only 8 symbols and operates on a data tape of bytes. It explains each symbol and provides an example Brainf**k program. Whitespace only recognizes space, tab, and newline characters and is very difficult to write but easy to include in a polyglot program. The document provides links for more information on Brainf**k and a tutorial on Whitespace.

Uploaded by

charity_iitm
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

Esoteric Programming

The document discusses two esoteric programming languages: Brainf**k and Whitespace. Brainf**k has only 8 symbols and operates on a data tape of bytes. It explains each symbol and provides an example Brainf**k program. Whitespace only recognizes space, tab, and newline characters and is very difficult to write but easy to include in a polyglot program. The document provides links for more information on Brainf**k and a tutorial on Whitespace.

Uploaded by

charity_iitm
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

POLYGLOTANDESOTERICPROGRAMMINGLANGUAGES

AcoupleofesotericprogramminglanguageslikeBrainf**k,whitespaceisalsoincludedinthecontest
Itwillbeinterestingtodiscusssomefactsaboutthemhere.
Brainf**kinterpreterneglectseverythingexceptthe8symbols"><,.[]+"soabrainf**kprogramcanbe
includedinanyprogramwithincomments.
Itconsistsofonlyeightcommands.
Character Meaning
>
<
+
.
,
[
]

incrementthedatapointer(topointtothenextcelltotheright).
decrementthedatapointer(topointtothenextcelltotheleft).
increment(increasebyone)thebyteatthedatapointer.
decrement(decreasebyone)thebyteatthedatapointer.
outputthevalueofthebyteatthedatapointer.
acceptonebyteofinput,storingitsvalueinthebyteatthedatapointer.
ifthebyteatthedatapointeriszero,theninsteadofmovingtheinstructionpointerforwardtothe
nextcommand,jumpitforwardtothecommandafterthematching]command.
ifthebyteatthedatapointerisnonzero,theninsteadofmovingtheinstructionpointerforwardto
thenextcommand,jumpitbacktothecommandafterthematching[command.

ToknowmoreaboutBrainf**kgotohttp://en.wikipedia.org/wiki/Brainfuck

Example
AbilingualinCandBrainf**kwhichtakesasinputastringoflength5andprintsitsinreverse...
#definebrainfck,>,>,>,>,>,<.<.<.<.<.
#include<stdio.h>
main()
{
inti;
chars[5];
for(i=0;i<5;i++)
s[i]=getchar();
for(i=4;i>1;i)
putchar(s[i]);
putchar('\n');
}

AbilingualinCandBrainf**kwhichtakesasinputa6bitdecimalnumberandprintsitsbinaryequivalentis
/*+++>>,>,>++++++++[<<>>]<<[>++++++++++<]>[>>>+>+<<<<]>>>[<<<+>>>]<<<[[>+>]<<]<[>>]>>[

<+>>+<]>[>><<]>++++++++[>++++++<]>[>>>>>>>>+<<<<<<<<][]<<<<[<+>>>>>+<<<<]<[>+<]>[[>+>]<<]<[>>]
>>[<+>>+<]>[>><<]>++++++++[>++++++<]>[>>>>>>>+<<<<<<<][]<<<<[<+>>>>>+<<<<]<[>+<]>[[>+>]<<]<[>>]
>>[<+>>+<]>[>><<]>++++++++[>++++++<]>[>>>>>>+<<<<<<][]<<<<[<+>>>>>+<<<<]<[>+<]>[[>+>]<<]<[>>]
>>[<+>>+<]>[>><<]>++++++++[>++++++<]>[>>>>>+<<<<<][]<<<<[<+>>>>>+<<<<]<[>+<]>[[>+>]<<]<[>>]>>[
<+>>+<]>[>><<]>++++++++[>++++++<]>[>>>>+<<<<][]<<<<[<+>>>>>+<<<<]<[>+<]>[[>+>]<<]<[>>]>>[
<+>>+<]>[>><<]>++++++++[>++++++<]>[>>>+<<<][]<<<<[<+>>>>>+<<<<]<[>+<]>>>>>>>>.>.>.>.>.>.>>>>>*/

#include<stdio.h>
#include<math.h>
main()
{
inti,k;
scanf("%d",&i);
for(k=5;k>1;k)
{
if(i>=pow(2,k))
{
putchar('1');
i=pow(2,k);
}
else
putchar('0');

}
}

NextistheesotericprogramminglanguageWhiteSpacewhichneglectseverythingexceptspace,tabandenter.
Agoodtutorialaboutthisisavailableathttp://compsoc.dur.ac.uk/whitespace/tutorial.php
Asyoumayseeitsveryeasytoincludeawhitespaceprograminapolyglottoincreasethecountbutitsverytough
t
towriteone.

You might also like