Learn how to implement languages

Published on 30 August 2012.

In the book Structure and Interpretation of Computer Programs, the authors suggest that programming is about language design. They argue that no existing language is suitable for your particular problem, and therefore your job as a programmer is to design and implement a language in which your problem is easy to solve.

The most obvious interpretation of this statement is that you should create a language that has its own syntax. Then you have for sure created a new language. Another possible interpretation is that you should create abstractions in an existing language that lets you solve your problem in a straightforward way. Even though the syntax is Ruby or Python or whatever language you choose, the abstractions make it feel like its own language. It has primitives and operations related to the problem domain.

If any of these two approaches to solving programming problems are used at all (I don’t think they are used enough), I think the second one is more common. I haven’t seen a lot of cases where a new language with its own syntax was created to solve a problem.

Why is that? One reason might be that implementing languages are considered hard. We can eliminate that reason by learning how to implement languages. If you believe, like I do, that programming is about language design, I think you will agree that learning how to implement languages is worthwhile.

Here are some topics of the top of my head that might be interesting to study: bootstrapping, parsing, syntax directed translation, virtual machine, BNF, recursive descent parser, metacompiler, and compiler-compiler. Learning about these topics might reveal a different way to solve programming problems.

Site proudly generated by Hakyll.