A Beginner Tackling “Writing a Compiler in GO” and “Writing an Interpreter in GO” in Rust: The Beginning

##The Beginning

Starting off a bit self-deprecatingly, calling me a “beginner” is a bit too kind. While I’ve taken some classes in high school and undergrad on Java, Python, and C++; I haven’t really touched programming substantially in about nine years. I can still parse some of these languages, but asking me to write them would be painful and result in many requests to our new AI overlords for help (for them to write the code).

Even at the time I “knew” how to program, it was all simple things, such as disjointed homework projects. Still, my grasp of them was tenuous. A favorite story of some of my friends in high school was the time we were supposed to be learning about loops. The problem was simple: write a program that outputted 1-25, each number on a new line. While I understood the concept of loops, I didn’t understand how it worked in the code. But hey, hard coding a print line 1-25 seemed like a good option. If you just ran the code it still output the correct answer. It worked perfectly until the teacher came up to me and asked me to try again holding a sheet of paper with my “program” printed out showing the secret of not actually using a loop.

Fast forward several years and I am currently working a job that doesn’t require any tech skills beyond opening a web browser and Microsoft Word. During some self-reflection, I realized I hid my enjoyment of technology internally for many years, it was still something that I thought about from time-to-time as I worked on some hobby stuff projects such as building custom keyboards, setting up a home-lab, and booting up some projects I found on GitHub.

In 2023, Generative AI hit the mainstream. And I was lucky enough to enter a “Prompt Engineering” class that was paid for by my employer. Accidentally, we signed up for the advanced class, so I got to teach my co-workers how to set up GitHub and VS Code; guiding them through the process of downloading the files necessary for the classes and accessing their API keys. I was having a blast!

Eventually the YouTube algorithm ‘realized’ I would probably enjoy some programming content. After watching way too many videos by ThePrimeagen and nearly the entire catalog of No Boilerplate, I decided something. I should learn programming and what better way to start again than a language with a difficult learning curve: Rust.

I’ve usually taken the hard road instead of the easy one. The interesting things are more often the difficult path rather then the easy path, and what could be more difficult than learning a new programming language from basically scratch while trying to build a compiler and interpreter? We will see. I’ll attempt to keep you updated with the progress and perhaps the projects that distract me on the way.

Graham29

A personal blog about assorted projects I’m working on.


2024-06-27