Attila's Blog

About writing your own programming language in C, Go and Swift


May 24, 2018 Comments

Categories: aspl

So what is this project about?

It was not long ago that I fell in love with programming languages. For the sake of clarity, I am not talking about learning or start using new languages. Been there, done that, got multiple t-shirts during the last 20 years. What I mean is to write my own programming language. Why, you might ask.

The answer is twofold.

During my time as an IT professional, I had the pleasure working on many different things, like:

  • full stack web development
  • desktop apps
  • multimedia apps
  • games
  • native mobile apps
  • banking systems
  • trading systems
  • ATM transaction processing
  • programming call centers
  • database development

But in the last couple of months I started getting the feeling that I need something new. Something big and exciting that I have never done before. Something that would force me to face and overcome new challenges.

One day, I found a few blog posts about writing programming languages, and after plowing through them I knew, this is it. This is going to be the next milestone on my professional journey. Programming languages are a vast space to explore. It is surely big enough bite for me to feel motivated and filled with excitement to prove myself.

The other reason is that anything I’ve been doing with computers in the past involved working with languages. No matter what you are working on, you need a language to make it happen. Somehow this gives me the feeling that if I can do something as fundamental as writing a language of my own, I will be able to do anything. Well, almost anything. It would be like having superpowers :)

The purpose of these posts is to document my journey as I cut through the obstacles this world will make me face. You are more than welcome to tag along if you are interested. This will be a stimulating and rewarding jouney that will help us in our professional and personal development. That means we are going to build knowledge and hone skills that will help us solve problems and create solutions faster and easier than before.

What is the plan?

It is simple. Learn how to write a language of my own. I will start small, and extend the language with new features as I go.

First, I will write a tiny scripting language with only the very basic features. At the beginning it won’t feel like a language at all. It’s going to be like a basic arithmetic calulator. Then, I will slowly add new features until I have a full-featured, efficient language.

Since this is a learning project, I am going to spend time with both theory and practice.

I plan to have dynamic typing, garbage collection, a bytecode virtual machine, object orientation with classes and inheritance, closures, global and local functions and variables.

Later on, when this is all done and working, I would like to replace the bytecode virtual machine with a JIT compiler. I will also write some custom memory allocators to speed the virtual machine up.

After this, I will ditch the bytecode interpreter and the JIT compiler and write a full-blown compiler and turn the scripting language into a compiled one.

Stay tuned. I’ll be back.

Why should I do this? →

comments powered by Disqus