Watch the Experts Zone #8 with Jakub about esolangs. Jakub Leszczynski will present concepts and examples of esoteric programming languages. Do you want to implement inspiring projects with us? Visit https://frontendhouse.com careers section.
In the "All About Esolangs: Chicken, Shakespeare and more" episode you will find:
- 00:00 - Intro
- 00:50 - Esolangs
- 01:10 - Chicken language
- 05:48 - Shakespeare
- 10:49 - LOLCODE
- 16:10 - Brainafck
- 18:22 - JSF*ck
- 22:16 - C+=
- 25:17 - Honorable mentions (Chref, ArnoldC, omgrofl, 133t)
Have a nice watch! Don’t forget to like the video and leave comments to share your impressions!
Transcription
Hi. My name is Jakub. I'm a front end developer at Frontend House, and this is Experts Zone. Usually at Frontend House, we try to break down some important technical topics so that you can write better code. But today we'll be a bit different. Today I'll be talking about the weirdest programming languages.
So without further ado, let's jump in.
Esolang - esoteric programming language
So just before I get to the list of the weirdest programming languages, I'd like to introduce you to a concept of esolangs. And esolangs are languages that are designed to be unique, difficult to program in, or just plain weird. And you will see that I have some really weird languages on my list today.
Chicken language
The first language that I would like to talk about is the Chicken language. Its uniqueness comes from that you can only use one keyword to write its code and it's chicken. Simply speaking it's a language based on chickens.
And let's jump into the documentation and I'll show you how to write Hello world! in it. As you can see, I jumped to esolangs.org, which is Wikipedia for all the esoteric languages. Some of them unfortunately don't have their own pages. But esolang is there to save the world and contain the documentation of all the weirdest programming languages. And as you can see, there's a bit of the documentation here.
And this is basically how the Hello world! looks like. The way that this language works is that depending on how many chickens you write in one line, a different instruction will execute. So you can see that for example, if we type only one chicken in our line, then this will push the string chicken onto the stack. And there are a couple of instructions that we can use.
And this is how the complete Hello world! looks like. As you can see, it's quite lengthy. There are also other examples that we can find on this page. Like, for example, the Cat program. The Cat program prints our input.
There are also a couple of more examples of different programs written in Chicken. And there's also a section for mini chicken, which is basically a simplification to the Chicken language - instead of typing the chicken 20 times in one line, you can just say 20 and then 5 and then 0, and this will execute some program. On the Internet, you can also find a compiler for the Chicken language and it's unfortunately on the web archive, but you can still play with it. And we have the exact same source code for the Hello world! program and we can run it on the web and we do output Hello world!.
We can also try other programs like the Quine program, which will just output chicken. So if we just type chicken in the Chicken language and output chicken, you can also play with the Cat programs, so we can modify it a little bit and then it will output our input.
There's also like 99 chickens program. Let me type 100 here and we did output hundreds of chickens for me as you can see. Now, you might be wondering why anyone in the world would make a Chicken language, and there's a paper explaining it. It's also worth noticing that the Chicken language is 14 years old now. And there's a paper prepared by Doug Zongker that explains why he created the Chicken language.
And there is very useful information here. As you can see, there are also graphs explaining the process. Yeah, there are three pages of pure knowledge. As you can see, there are a lot of interesting things. You can see some binary computations here.
You can also see the math behind the Chicken language, explaining everything to you. Some nice graphs as well. Yeah. So this is basically why the Chicken language was created. There's also an interesting presentation on YouTube that further explains the topic of why the Chicken language was created.
And I highly recommend you watch that. The link will be in the description. It's really fun. I was really enjoying myself when I was watching it, and I hope you will too. And that would be it for the Chicken language. I hope you enjoyed it. If you want to, you can play with it online.
You can maybe try to write some programs on your own. It was too difficult for me to modify its code, but maybe you will be better than me.
Shakespeare
And now let's jump into the second language, the Shakespeare language. And the idea behind Shakespeare language is to make the code of your programs look like Shakespeare play. Now I'm showing you the original Shakespeare Programming Language document, as you can see, it's even older than the Chicken language.
This one is 21 years old and in the original documentation, everything is really neatly explained, but it's kind of difficult to grasp. But as we can see, we have a Hello world! example, which is probably the longest Hello world! that you will ever see. And it really does look like a Shakespeare play. So we have Romeo and we have Juliet, and they are on a journey to print Hello world! for us. If you want to learn more about Shakespeare Programming Language, then I highly recommend going to the Shakespearelang.com website, which is a refreshed version of the previous website. And you can basically see everything that has been created, that comes from the community of Shakespeare language.
If you want to play with it on your computer, then I recommend going to the Shakespeare Lang Python interpreter which also features things like debugging and so on. So you can really write code in it. Maybe not production code, but it's doable at least. Now I would like to show you how the online interpreter written in Python works. And as you can see, I have a couple of Shakespeare language files stored on my laptop and you can see that it's basically the same code for the Hello world! program that we've seen on the website. And I can use the Shakespeare compiler to type Shakespeare run hello.spl and it will actually print the Hello world! for us.
There's also another program that I found on the Internet which is Primes. We just input some number and it will print prime numbers up to that number all written in the Shakespeare language, which is awesome.
The source code for Primes looks somewhat like this, which actually looks a bit shorter than the Hello world! example, which is kind of interesting. But yeah, you can dive deeper into this language if you want to. The basic idea is that... If this is, for example, one sentence and the clue is that if we say speak your mind in a line, then this will print something to the user. And there are lots of different instructions that look like sentences from plain English, and that is two different things in this language.
You can see, for example, a lot of exiting and entering of different characters. And this means basically introducing new variables to the scope of our program.
But what is actually really cool about the interpreter that I showed you is that it also features debugging. Now let me modify the Hello world! example a little bit. And how in the play would you actually state that you want to pause the program execution. Well, you would say [A pause], so this is basically our debugger statement.
And now I can use the Shaekspere interpreter and type debug. And then hello.spl. And as you can see up to the point of my [A pause], we managed to print four letters. Now I can type next, which will execute the next statement. And as you can see, a lot of things happen here. You can see a couple of speaker minds here. And this actually prints letter W for us. And also I believe it printed the white space. So this one actually prints white space. And this one actually prints the letter W, and that would be it for the Shackspeare Lang. It's interesting.
If you write any programs with the Shakspeare Lang, please don't hesitate to share it.
LOLCODE
Another language on my list of the weirdest programming languages is LOLCODE. And well, you just have to see it for yourself. The documentation for LOLCODE, you can visit it at Lolcode.org. It has a couple of things here. So this is a Hello world! example In LOLCODE.
Every LOLCODE program has started with HAI and then point to the version of LOLCODE, and also has to end with KTHXBYE. This CAN HAS STDIO? is a way to import libraries, and whenever we type VISIBLE, it will print the string we are supplying. And you can see that we have an interpreter that we can download. But first, let's go to the language page, and this explains how to do all sorts of different things in this language.
And you can see, for example, how to declare variables. You do so by saying I HAS A VAR and then BTW is the way to write a comment in your code. If you want a multi-line comment, then this one begins with OBTB (o by the way), and then ends with TLDR. So it's an interesting way to write your programs I'd say. As you can see, there's also examples of assigning values to our variables.
So over here we did declare a variable VAR and then VAR R “THREE”. It also explains here in the comment VAR is now YARN, which is a type in lower code, which you might know as string. And then we assign the value of three. Also, there isn't a number in this language. And you can see all different types that are supported in this language.
There are numerical types, string types. There are also arrays, which I believe right now aren't specified.
And yeah, you can do all sorts of different things in this language. And this language also has a really, I'd say, rich community for an esolang. There are people creating different kinds of programs in this language, and I would like to show you that. Through the website that I showed you you can access the mailing list of LOLCODE. It isn't really that active, but it's active enough that it produced a couple of interesting programs. And let's run one of them using the lci, which is LOLCODE interpreter that you can also download from the official page.
And let's run the calculator program. And this one is interesting because it actually supports two languages. It supports English and Polish. Let's speak English, and then it will print a nice message for us - Welcome in calculator. Input first number. Let's input 10. For the second number
I'll input 2. And then we can choose the operation. The supported operations right now are add, subtract, multiply, and divide. Let's subtract and it will print 8. So it's a fully working calculator using LOLCODE programming language. And let's also see what are the contents of this calculator.
And as you can see, there are some variables created here. We also have some visible statements. So this would be our if else I believe. So whenever we say O RLY? and we say YA RLY
Then it means that this code will execute and this is our else statement, which is NO WAI. And this would be actually, I believe, our switch case statement, which is interesting. A lot of things are supported in this language. So many things are supported in this language that actually someone prepared a Ray tracing program that renders images. Someone wrote a program that renders images in local, which is kind of interesting.
I tried running this program, but I don't know if it works because LOLCODE probably isn't the fastest language that you can use. To render a simple image It took the outer of the program 40 hours to render. So if you want to check out if it works, you can try running it on your own. But yeah, it will take a couple of days.
Brainf*ck
The next language on the list is brainf*ck / brainfuck. And the idea behind it was to create a language that needs the smallest possible compiler.
And the compiler for brainfck is only 240 bytes, and this results in the code looking really weird. So this language actually turns out to be really difficult to program in. A lot more difficult than the other programming languages that I've been showing you. So these are, I believe, all the possible words or signs that you can use to write your code in brainfck. And there's an example of Hello world! program, which has all the things explained.
And this is actually the minified form of the Hello world! program. And well, you can't really say what's going on here without at least putting it to that form. And even if you see it like that, I think it's too difficult to understand. There's online interpreter for brainf*ck, which you can see here. And you can try running some different programs here.
And this will, for example, print this string. Let's try copying the Hello World! program, and yeah, it printed Hello World! in seven milliseconds. Let's maybe try a bit more functional program. And this is a Cat program written in brainf*ck. So let's try it out. And I believe you input something here and yeah, it did work. It also prints a lot of o for us, but that's the job.
JSF*ck
Now, you may not be expecting to see JavaScript on this list, and well, JavaScript isn’t an esolang, right? It's a computer programming language that is used in business all across the world, so it shouldn't be an esolang. Right.
But then there's something like JSFck, which is very similar to brainfck in a manner of how the code looks like, but it will see for yourselves. So this is a website for this language, and this is basically what the example code in JSF*ck looks like. And it's basically different signs that you can use in JavaScript, like, for example, opening parentheses and closing it, or the exclamation mark. And this is based on what we type here, so we can slightly modify it. So right now it contains 2345 characters.
I'll encode it and you can see that the number of characters has changed. You can also run this and this will print an alert onto our browsers. We can also test it by opening the console, printing it over here. And you'll also see that it works. So you might be wondering why it works.
And it works because this code here is valid JavaScript. So potentially every piece of code that's right in JavaScript, you could compile into this version. And the idea behind it is to create the most obfuscated minified or minified... It's not really minified because look for just a couple of characters that we typed here. We have already 2372 characters, which is quite a lot I'd say, so it's just obfuscating the code.
There's a section explaining how it actually works. This contains all the basics, and as you can see, the way it operates is, for example, if we use an array, but also say exclamation mark at the very start, we will convert that value to Boolean. And if you want to, for example, say function, and then it will actually create a function for us. Javascript is weird. There's also a full list containing all the different hints on how this language works, or maybe how the compiler for JSF*ck works.
And as you can see, if we want to print a specific letter, then can, for example, use this piece of code. This will print the letter H for us. And now let's actually pick something different. So this piece of code prints the letter F because, well, we're casting false to string, and then picking the first element from array, which is the letter F. And we can also use this piece of code instead of our false.
And it will also print the same letter. And basically that's the way this language operates. So whenever there's a piece of our code, it transforms everything using those references to... well, you've seen what it creates.
C+=
The last language I have for you isn't actually an esolang. It's more of a concept of a language, and it's C+=. And let's jump into its documentation.
C+= is a bit different from all the other languages that I've spoken about. The documentation states that it's the world's first feminist programming language, and it approaches some of programming concepts in a different way. The documentation is quite lengthy, and I cannot explain everything that happens here. But as you can see, we don't have some of our basic keywords.
So for example, instead of private, we have to say privileged instead of printf(); we have to say yelp();, we don't also have classes. We only have social constructs. We cannot also tell a library that we have to include them. We have to tell our program that it can consider importing a language.
Some of the most interesting things about C+= is that, well, it would be really a mess if we, for example, created a variable and then told it that it has to be a string. Or maybe this variable has fillings and it actually doesn't feel like a string. Maybe it wants to be a number in the future. Who knows? And this language allows that.
So whenever you create a variable and you say that it's a string, it has a 50% chance, I believe, of converting to a different type. Another thing is that we, for example, cannot tell the code that it has to go to a line. Instead, we tell the program that it might consider a jump, which is obviously a much better approach.
Another interesting thing is that we don't have Booleans because, well, not everything is binary. Instead, we have a concept called the Boolean+, and you can see how it basically works.
The last thing that I'd like to talk about regarding the C+= is the debugging section, which states that there are no bugs, there are only snowflakes, and that there are no bugs in this language and suggests otherwise is offensive.
Esolangs - honorable mentions (Chref, ArnoldC, omgrofl, l33t)
Overall, there are a lot of funny things in this documentation, and if it's your type of humor, then I recommend going to check it out. There are also a couple of more languages that are interesting and you can discover them on your own. The first one is the Chef language - works in a similar way that the Shakespeare language does. Shakespeare language wanted to make the code look like Shakespeare's play, while the Chef language wants to make the source code look like a recipe, which is interesting. There's also ArnoldC. It’s a language that only allows one-liners of Arnold Schwarzenegger in this code.
You can also check it out. There's also omgrofl, which is very similar to LOLCODE actually. And the last one is l33t, which is also a similar fashion to LOLCODE but a bit different. Do you know other esoteric programming languages? Maybe Piet, I like frog, Autopsy or two dimensional Befunge? Share with us!
Thank you. That would be it for today's episode.
Don't forget to check our website frontendhouse.com and also if you haven't just yet, go and watch that video presentation regarding the Chicken language. Thank you.