Skip to content

GahwaScript: A Superset of JavaScript with Arabic Flavor

Published: at 14:26

Wow it took quite a while to get this post up and running, eh?! I’ve been trying to figure out my writing style and the first version of this post was insanely long and boring. I had a whole section on my experiences in highschool. I mean, who cares about that? I’m not writing a memoir, I’m writing a blog post about a programming language I made.

Table of Contents

Context

So you’ve just joined a big corporation! Congratulations! You’re now a small fish in a big pond. You’re surrounded by people who are very smart. How are you going to stand out and prove yourself? Well, it’s quite simple really. You just need to have a party trick. Something that makes you stand out. Something that sounds impressive when you tell people about it.

I remember my brother doing the rubik’s cube while waiting for a hospital appointment. The medical staff, all very smart people, looked at my brother with awe. They were impressed that my brother could solve a rubik’s cube because they couldn’t, so they jumped to the conclusion that my brother was smarter than them. I mean, he is pretty damn smart, but not because he can solve a rubik’s cube.

Taking inspiration from my brother’s rubik’s cube incident at the hospital, I decided that I will create a party trick of my own. Something that people will see and be like, “that’s impressive, Ahmed must know what he’s doing”. That’s when I decided to create GahwaScript. After all, I was just getting started in my career and you kinda need to prove that you’re worth your salt to get a good project.

In case you’re wondering, shortly after I made GahwaScript, I was able to talk about it to a client and they were so impressed that they chose to work with me over a developer who had way more experience than me. So I guess it worked. I suppose the moral of the story is that you should always have a party trick.

So what is GahwaScript?

GahwaScript

I was very honest with you in the introduction. I told you that I made GahwaScript for my own personal gain. But know that I would not have made it it not been for the fact that I loved the idea. It made a lot of sense to me. The english language is to some degree a gatekeeper to the world of programming.

My father had sent me to an english school when I was a kid. It was not easy and I was a child, with a malleable brain. I feel like it would be a hundred times more difficult for an adult to learn programming while also learning to code. After all, the english language is foundational to the world of programming.

There are only two hard things in computer science: cache invalidation and naming things.

- Phil Karlton

So what if we could make a programming language that was actually useful but in another language? The other language bit was easy to figure out. I’m Arab and I speak Arabic. If I wrote a programming language with Arabic keywords, then that’s one less obstacle for me. This isn’t a new idea. Here are some examples of non-english programming languages.

The more difficult bit was making the language actually useful. I could have built a language that was just a toy, but I wanted to build something that people could actually use to build real things. If I wanted to do that, then I would have to build something that could interact with an existing developer ecosystem.

I took inspiration from the world of JavaScript, with all the transpilers that exist in this space. Particularly, I took inspiration from CoffeeScript. CoffeeScript is a superset of JavaScript that adds types to the language. CoffeeScript is compiled down to JavaScript so that it can run in the browser and on Node.js.

Hence the name GahwaScript. Gahwa is the arabic word for coffee in the Iraqi dialect (and in others), where I’m from. I thought it was a fitting name for a language that is a superset of JavaScript. It’s also a fun name to say.

The Challenges I Faced

1. Skill Issue

skill issue meme

The biggest challenge I faced was that I was simply not a great software engineer when I started this project. I didn’t appreciate all the complexities of the JavaScript ecosystem. For example, what module syntax should I use? What about the build system? How do I make sure that my code is performant? How do I make sure that my code is secure?

2. Right-to-Left Text Direction

قهوة سكريبت is GahwaScript in Arabic.

Guess how many code editors support right-to-left text direction? Not many is the answer… So users have this text area on GahwaScript.com where they can write their code. The text area is styled to be right-to-left.

I think this is simply not good enough to satisfy the requirement of this programming language being useful.

Here’s an interesting article on this topic.

3. Scope of Compilers

The compiler is not just a thing that changes the keywords from Arabic to English. It also has to make sure that the code is valid JavaScript. Additionally, what does GahwaScript compile to? Is GahwaScript supposed to run in the browser or on Node.js? The compiler should really be able to do both.

What’s more is that a compiler is horrible to work with if it doesn’t provide useful error messages when the code is not valid. It would also be nice if there is a language server that communicated with the IDE or code editor to show the users errors in real time.

I suppose what I’m trying to say is that the compiler is a complex piece of software and though I knew that when I started, I didn’t appreciate the nuances of it.

4. No English?

Let’s say you’re trying to build a blog with GahwaScript. You see that there’s this really cool JavaScript framework called Astro, which is awesome for building content-heavy websites. You want to use Astro to build your blog, but Astro is written in the english JavaScript, not the arabic one. So you can’t use it.

I didn’t really think this bit through, especially given that sometimes these things invent their own languages. Should I also invent GahwaScript Extensions if the user of this language wants to use a library that has JSX in it?

5. No Community

I think the biggest challenge I faced was that I was working on this project. I was the only one working on it. I also had little experience in the world of open source. I didn’t know how to get people to contribute to the project.

Furthermore, I didn’t know any arabic speaking software engineers period. For future success, I think it would be wise to build a community of people to share ideas and discuss the future of the language.

6. No Time

When I started this project, I was kinda free, on the bench as they say in Accenture. I wasn’t assigned on a client project and I had some time on my hands. I was able to work on this project for a few hours every day. But then once I landed a project, I focused exclusively on that project.

I had an exceptional amount of work to do on that project and I was working long hours. I didn’t have the time to work on GahwaScript. I also didn’t have the energy to work on it. I was tired and I just wanted to relax when I logged off.

What Happened Since?

Well, not much has happened since I stopped working on GahwaScript. I’ve been working on a project for a client and I’ve been learning a lot of new things. I’ve been studying the world of JavaScript based languages and how they work on the side.

I’ve also been thinking about the future of GahwaScript. I think it would be wise to approach this project with higher maturity. Having reflected on the challenges faced, I would do the following if I were to revisit this project:

  1. Define Technical Scope: I would define the scope of the project more clearly. I would also define the scope of the compiler more clearly. What does the compiler do? What does it not do? How will we implement the Language Server? How do we deal with compatibility layers?
  2. Build a Community: I would build a community of like minded individuals who are interested in the project. I would also reach out to arabic speaking software engineers to get their feedback on the project. I would also strive to create a communication channel for contributors to discuss the future of the project.
  3. Improve the Documentation: I would improve the documentation of the project. I would also write more blog posts about the project to get more people interested in it.

Conclusion

GahwaScript is a project that started as a party trick to get me on a cool project. It was a project that I was very passionate about and I still am. Unfortunately, I didn’t have the time to continue working on it. That said, as I’ve gotten more experience in the world of software engineering, I’ve realized that there are a lot of things that I could have done better.

If I get back to this project, which I really hope I do, I would take the lessons learned from the previous iteration and apply them to the new one. I’m excited about the possibilities and I’m excited to see where this project goes.

Fun Fact

When I wrote the code for GahwaScript, A big challenge was writing arabic characters using a regular english keyboard. To make my life easier, I wrote it using a 2011 MacBook Pro with an Arabic Keyboard 🤣

2011 MacBook Pro