Published on 29th May, 2024

I am writing a Programming Language

As I type this, I can't believe the title I just typed above. What kind of weird people write programming languages?, Well after this project I will know.

You are kidding right ?

When I got into programming, I was curious about how programming languages were built. I asked the internet this question several times and read findings from time to time but I never really understood how they were made, in fact it didn't make sense to me.

All I learned from those searches was, "Programming languages are built with other programming languages." I just pretended that I understood that. This was a time when I didn't know about languages considered high-level and others considered low-level.

I didn't know what was a compiler or what was an interpreter. Suffice to say I was just curious, I had no intentions of building one, even if someone put that thought in my head, I would have called them crazy.

Part of my interest in computers and programming led me to trivia like who created which programming language. Have you seen a picture of Bjarne Stroustrup? Larry Wall? James Gosling? Guido Van Rossum was the only one I felt was approachable among the bunch of the programming language creator nerds. I didn't know about Dennis Ritchie, Brian Kernighan and Ken Thompson at the time, but I would later learn about them and be very much inspired by them. In an alternate world, If I were in the US and at Bell, I would have definitely gone down their route. And later I learned about Rob Pike - great guy, worked with the greatest langauge creator nerds, also behind the Plan 9 OS and the Go programming language at Google. - Robert Nystrom, another amazing guy, works on the Dart programming language at google and the author of the crafting interpreters book. Heard of Graydon Hoare? The creator of Rust? weird guy, try finding his picture on the internet. I admire weirdness like that, Imagine being popular through your work and yet little is known about you, Satoshi Nakamoto kind of weird.

You see where I am going? Well I am not saying learning and building a toy programming language will make you be like them, but these are the smart dudes that built the programming languages that I was learning, how on Mars, could I think I could understand the level of wizardry needed to build a computer program called a programming language. Nah, not my ballpark.

What happened ?

Glad you asked. TopRank happened. If you have watched my OS video or read my past articles, then you know TopRank. For the uninitiated, here we go What is TopRank

There have been a couple of instances that made me think that I wanted to be a Systems Engineer, even though I didn't know that is what it was called.

1. I wanted to build as Operating System to take Microsoft and Apple out of business, I have written extensively about that here

2. When I started using Nodejs, My question was how does one just gets up and say they want to create something like that, what level of wizardry is needed for that, big inspiration from Ryan Dahl.

3. When I wanted to learn reverse engineering and the introduction of the book I wanted to study from, mentioned a couple of books as prerequisites. This when "Programming languages are built with other programming languages" started to make sense, because among the books was the almighty Dragon Book.

4. When I learned about Jamie Zawinski - my favorite programmer - from Coders at Work, one thing that stood out to me was when Petr Norvig regarded jwz as one of the smartest programmers he has ever worked with. I thought if someone ever called me that, I would have made it in my pursuit of programming.

All these instances still never convinced me that I could create a programming language till again, TopRank happened. In Toprank, I got mentored by the amazing Yaw Boakye to build a toy Operating System, Oubre OS. The biggest lessons from joining Toprank was That I can build anything that I wanted, really. Anything that I want. Nothing is out of reach for me, I had passed the stage of tutorial hell, structured courses, easy stuff. Armed with that nothing can stop me, well, except time, if I wanted to build anything. Coupled with a quote by Steve Jobs that I have lived ever since I learned it:

"Everything around you that you call life was made up by people that were no smarter than you. And you can change it, you can influence it, you can build your own things that other people can use. Once you learn that, you'll never be the same again."

Immediately after I completed the OS project I decided to build a Spend tracker app. It was supposed to be a challenge. Because I had never done any mobile app dev.

My official learning duration for both Dart and Flutter was just two weeks, along the line I learned Realmdb, Riverpod and built the app and the code is right here Ferndi

Among the Projects in TopRank was proj-prog-lang (project programming language). My intention was to do the that after the OS. That never happened.

Enter DevCongress

One day, a member of DevCongress asked who was interested in compilers so we could create a study group. He didn't know he had just tickled me, I was all in, jumped onto the efforts of creating the the group and choosing the study material. We choose craftinginterpreters.com because why not. My first encounter with this Book was through TopRank, it was the study material of the proj-prog-lang. Even though I had the Dragon Book, this was the book that convinced me that it was possible that I could build a programming language.

Why Study Compilers ?

Well, it seems that every compiler book out there seems to have a chapter on why people should learn compilers.

I will very gladly continue that tradition here to tell you why I am learning compilers and why it excites me so much.

Curiosity

Since I joined TopRank, I have wanted to build a programming. There is so much to learn from building a programming language. The #1 reason for me is to simply satisfy my curiosity. To answer the question how are programming languages created? Yes, my curiosity is that strong to me down that path. I am on a journey to peel off the layers of programming language implementation to learn all the secrets. As Richard Feynman says, "What I cannot build, I do not understand"

Fun Challenge.

Building a programming language is a fun challenge. I am very much interested in challenging myself in terms of building myself up as an engineer, if you don't do hard things you can't grow. You need to push yourself to your limits that is the only way I know how to grow. A programming language ticks those boxes very well for me. Interest? Check. Challenge? Check. Fun? Check. So much to learn? Check.

Becoming a Better (Systems) Engineer.

Undoubtedly a programming language is a systems engineering project. What better way to become a better engineer, than to build systems projects? How exactly does building a programming language makes you a better engineer? You use hashmaps. Sometimes you need to use recursion in your code, You hear the cool guys throw around terms like trees, graphs, but do you really understand them? How about implementing them on your own? How about the knowing the limitations of the data structures of the programming language you use? How do you know which looping mechanisms is more performant for your use case, Getting your hands dirty in compiler implementation will greatly improve you in all these areas and even more.

Transferrable Knowledge and Skills

As I already mentioned above, learning compilers doesn't mean you will be a famous language designer like those I mentioned above, but learning about compilers gives you knowledge that is easily transferrable to several areas of programming, Compilers touch several fundamental parts of computing. Your favorite web frameworks, have compilers these days, understanding compilers will give you a greater edge in understanding diverse web frameworks without breaking a sweat compared to jumping on the new cool frameworks. Rather than jumping from one framework to another, it will be more beneficial to understand the fundamentals that all these frameworks are built on. Learn Compilers once, use everywhere. I once heard a Java guy say something like that. You don't trust my word on learning fundamentals? Take Richard Hamming's then, In The Art of Doing Science and Engineering, page 9 - counting from "1 Orientation" as page 1. he said:

"What is my answer to this dilemma? One answer is you must concentrate on fundamentals, at least what you think at the time are fundamentals, and also develop the ability to learn new fields of knowledge when they arise so you will not be left behind, as so many good engineers are in the long run ... How are you to recognize “fundamentals”? One test is they have lasted a long time. Another test is from the fundamentals all the rest of the field can be derived by using the standard methods in the field."

The things you learn from compilers are used in websites, web frameworks, small languages ( sql, awk, json, xml), database design, ORM, etc. One of the main reasons why I am learning compilers is because like Operating Systems most of the things you learn from compilers are completely transferrable. Programming languages are complex pieces of software, learning and building means you are learning the skills of reading and understanding complex programs, you can dive into the language you are using to understand how features of the language works and how to use it better, I am always reading the Rust source code you can do same for your web frameworks, I have done same on Flutter. I saw a meme recently that says "I just fixed a bug by reading the documentation" now imagine fixing a bug by reading the language's source code.

Thank you for reading this far. Charley, plenty rant!, See you later. I will be making Youtube videos documenting my journey, You can watch me Here.

Easter Egg

The Crafting Interpreters book does the language implementation in Java and C. I have never learned Java yet to make it even more challenging, I am writing my language in Rust. You can follow my implementation here Llama

What is in a name ?

Why is my programming language called Llama? You might think I choose it because of Meta's LLM AI, but nope. Around the type I was beginning work on the Programming Language, I remembered a Disney cartoon I watched and love as a kid, it is called The Emperor's New Groove, about a spoiled Emperor that got turned into a Llama, yeah the animal. So I chose it. I considered naming it Eon - from the TopRank days, based on another cartoon, Eon Kid - and later Tuchel after the German Professional Coach Thomas Tuchel, simply because I liked how the name sounded. Llama won, Thank you Kuzco Ha! Boom Baby.