Looking for a summer coding project? Try making a programming language!
I think that every programmer, new or experienced, could benefit from understanding a little bit about how the languages they use daily actually work.
As such, this is my collection of resources that I used to teach myself a little bit of Programming Language Theory last summer, which concluded in my creation of CI lisp.
I'm planning on doing something similar this summer, so I figured I'd invite other people to try a 'Summer of PLT' too.
Read a Book
If you're new to the field of programming languages, my first piece of advice is to read Crafting Interpreters! (or at least the first section, "A Treewalking Interpreter") In my opinion, there is no better way to break into the field of PLT than by reading Bob Nystrom's book on the subject: Crafting Interpreters. There's also a free HTML version on his site if you don't feel like paying money.
After that, I would suggest looking into Lisp.
Make a Lisp
Lisp is one of the foundational language of PLT. My advice to anyone trying to start in this field would be to make a Lisp. Its minimal syntax makes parsing and interpreting much easier.
For a nice overview (and a bit of history), check out the Wikipedia page on Lisp: Lisp (programming language).
Before making your lisp, it would probably be good if you knew Lisp. Here's a good resource for that: lisp-lang.org.
Theory-wise, I would recommend reading the original John McCarthy Lisp paper (be prepared for dense academic writing though): Recursive Functions of Symbolic Expressions and Their Computation by Machine.
Additionally, many suggest the book Structure and Interpretation of Computer Programs, which also includes some
The C2 lisp rant is also a fun read (but by no means required): Lost Ina Seaof Parentheses.
If you want more of a guided, handhold-y tutorial for making a lisp clone, I can only recommend mal - Make a Lisp. I personally have not gone through it, but I've heard good things.
What next?
After you make your lisp, you can use it as a playground for more ideas in the field of PLT.
Lambda Calculus
If you find yourself seeking more of the theory-side of PLT, consider learning Lambda Calculus and Church Encoding and implementing them in your lisp!
There's tons of resources on Lambda Calculus, but you can't go wrong with a skim of Alonzo Church's original book on the subject, The Calculi of Lambda-Conversion
Or you don't feel up to reading 1940s academic rhetoric, the Wikipedia page on Lambda Calculus is nice: Lambda calculus
Monadic IO
Also on the theory-heavy side, you could learn about Haskell's system for safe IO operations which use monads.
This paper on the subject (discovered on the Haskell wiki) is a pretty dense, but has all of the foundational ideas for Monadic IO in Haskell: Monadic I/O in Haskell 1.3.
The foundational ideas of Monads are well explained in Monads for functional programming by Phillip Wadler. I found this paper easier to understand than the prior one, and it gives you a great intuition for why Monads are cool. Definitely read this one!
Syntactic Sugar
If you're looking more into the practical side of PLT, you could look into adding syntactic sugar to your lisp. One source to look into might be David Wheeler's Sweet Expressions.
Bytecode VM
If you're interested in becoming more like the "real programming languages", you could look into writing a bytecode VM for your language. It's a big undertaking, but it's outlined very well in the second section of Crafting Interpreters, A Bytecode Virtual Machine.
Make a CAS (?)
If you're a math nerd (like me), you could look into writing a CAS hosted in your lisp. For me, this meant writing a deep pattern matching system and substitution engine. Definitely a fun project!
Try something else
Maybe you're sick of lisp? That's fine! There's lots of other PLT stuff that might suit your fancy:
Make a Forth -- Sorry, I don't have very much information on this one, but stack-based languages are pretty neat!
Make a Python -- You can extend the ideas of lexing and parsing to a more complicated syntax, leading to more of a Python-like experience
Did I interest you in a 'Summer of PLT'? Let me know! I'd love to see some toy lisps this summer!