This is the intro to a 5-part tutorial on how to implement a programming language. It is intended for people with some programming experience, who want to know how their compiler, interpreter or virtual machine works. Hint: it's not magic.
This installment explains why you might want to make your own programming language, and why this tutorial is better than others. Feel free to skip directly to Part 1 if you're impatient.
Note: here and there I'm going to reference advanced programming topics. You can follow the links (usually to Wikipedia) at your leisure. Don't worry, it's all rather easy, actually.
There are hundreds of programming languages out there, some of which have hundreds of dialects (BASIC...), so why would anyone bother to make another one?
Remember the exhilarating feeling you had when you first made a computer follow your instructions? The fun is double when you make the machine understand the instructions in the first place. Many, if not most programming languages were made for fun.
While you may be perfectly happy with PHP or Java most of the time, there are tasks much better expressed in other, more specialized languages. Can you imagine accessing databases whitout SQL, or processing strings whitout regular expressions? Well, many other programming tasks can benefit from domain specific languages, as they are called. If only you knew how to design and implement your own...
Nobody understands a programming language better than the man who created it. For example, read what Bjarne Stroustrup has to say about teaching programming with C++. It's an eye-opening experience. But even if you never use a language of your own, making one will help you understand how the languages you do use work on the inside. You will be a better programmer ever after.
There are many articles (even books!) on programming language construction. I'm writing mine with two purposes in mind:
In Part 1, we'll begin to build a simple programming language. Let's call it "Scratch", since we're making it from scratch and it is designed to scratch an itch.
P.S. After completing the whole tutorial, I learned there was a Scratch programming language already, kind of an educational Smalltalk for small children. *facepalm*