DEV Community

Cover image for Learning Compilers & Interpreters
Brett Martin
Brett Martin

Posted on

Learning Compilers & Interpreters

Photo by Anders Jildén on Unsplash

I have always found programming languages fascinating, and up until recently my fascination has been as a consumer. I loved to pick up new languages - learning new syntax, paradigms, and ways of thinking. However, I have recently been itching to write my own language(s)!

I really wish that I had the opportunity to take a compilers course at my university, but sadly I went to a small school that didn't offer the course, so that brings me to this series that I would like to write. I plan to make a new post every two weeks that follows my attempts to learn about programming languages and their implementations.

A Journey Starts With The First Step

To get started I have decided to follow along with a book that I found while googling around about "How to learn compilers". The book that I chose is called "Modern Compiler Implementation in ML" by Andrew Appel. He has written three instances of this book in three different implementation languages - C, Java, and ML. When deciding which version to follow I weighed my options and decided that even though I was familiar with both Java and C, I wanted to learn a new language as well. I also found that Standard ML was popular among compiler writers and language researchers, so in order to level up my knowledge this seemed like an excellent choice.

As you can imagine, tackling both this topic about a complicated subject and learning a new language at the same time would prove to be...difficult. Therefore, I have decided to spend this first two week cycle doing some cursory research on compiler & interpreter concepts, and try and build up my related vocabulary to make researching easier in the future.

I also plan on deep diving into learning Standard ML with the following book: "Programming in Standard ML" by Robert Harper. It seems like an interesting approach to covering the material, jumping headfirst into writing a regex package, then taking a dive into the core concepts of the language.

Once I feel comfortable enough with the core concepts of Standard ML, I will begin my journey into compiler implementation! I will be pushing my code snippets up to the following repo as I learn - my github account will be where I post the majority of my code as well.

Goals

I figure that it would be a good time to set some goals as well - some will be goals related to these posts, others to compiler & interpreter implementation. I will be looking at this as goals for the next year.

  1. I will provide an update on my progress every 2 weeks. In these updates I will give my thoughts, progress, and share as much as I can about what I have learned.
  2. I will make it through Part 1 of the "Modern Compiler Implementation in ML" book, which is titled "Fundamentals of Compilation".
  3. I will start to design a new language that I can start implementing after achieving goal 2.
  4. I will record all materials that I have gathered throughout this process.

Closing Thoughts

One reason I want to write about this topic is to find others who have gone before me, as well as those that are also interested in taking these first steps. The entire point of a platform like dev.to is to build a community so I will also be actively looking out for other authors to connect with and learn from.

If you happen to be reading this and want to join me, feel free to follow or comment. I would love to hear about your journey - from pitfalls to triumphs!

I will see you all back here on January 4th for the first post! 👋

Top comments (0)