Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Crusty Interpreter

Upcoming Course Dates:

Course Hours:

Cost:

  • $1500

Registration (no payment required now):

Instructor: David Beazley

Other Courses | FAQ


This course is part of the Summer of Rust series. The Ruckus course is a suggested warmup.

In Short

Challenge yourself by implementing an interpreter for a programming language that you don't know (Lox) in a programming language that you might not know (Rust) from a book that uses a programming language that a lot of people used to know (Java).

Overview

Sometimes in college, you would take one of THOSE courses where the professor shows up on the first day and gives out a modest first assignment like "design an CPU instruction set architecture", "implement the Unix shell from scratch", or "solve the Dirac equation." When faced with such a prospect, some students flee to higher ground while others start sporting a wry smile that says "bring it." This course is kind of like that.

Starting from nothing, you'll be dropped into Robert Nystrom's excellent Crafting Interpreters book and tasked with the problem of implementing a tokenizer and recursive descent parser as a first exposure to Rust programming. After that, things start to get hard as you go on to implement as much of the Lox programming language that you can handle before your head completely explodes.

Target Audience

This course is for experienced programmers who want to improve their programming skills by undertaking a good coding challenge in a modern programming language. Maybe you see yourself here:

Seriously, this course is difficult in the same way that running a marathon is difficult. While it's happening, you'll probably be thinking WTF have I gotten myself into?!? However, when it's over, you'll feel pretty good about it.

Instruction Format

This is a week-long project course. At the start of each day, we'll discuss a variety of topics from programming language design and how they pertain to the Rust language and the project at hand. However, most of our time will be spent suffering, er, I mean "coding." There will be periodic discussion sessions throughout the day to discuss the difficulties encountered (if any).

Prerequisites

You should be experienced with common concepts from programming languages including expressions, statements, variables, control flow, functions, and classes. Prior experience implementing some kind of interpreter (in any programming language) will be helpful, but is not strictly required. No prior experience with Rust is assumed, but you should be prepared to jump into it at an accelerated pace. Rust is not the easiest language to learn, so expect a fair bit of fumbling around at the beginning.

Syllabus

The primary goal is to complete the first ten chapters of the Crafting Interpreters book wherein a tree-walking interpreter for the Lox programming language is created. In doing so, the following core topics related to programming language implementation get covered:

In implementing the interpreter, you will also be exposed to a variety of Rust programming issues including:

The Crafting Interpreters book contains code samples for everything that needs to be coded, but they are all written in Java and make use of certain idioms that don't directly translate to Rust. Part of the challenge involves understanding the task at hand well enough to code it. This extra difficulty actually makes for interesting course discussion.

Questions and Answers

Q: I already worked through Crafting Interpreters in another programming language. Will I be bored?

A: Unlikely. Rust is *very* different than most other programming languages and presents a wide variety of new challenges that you probably didn't have to think about before.

Q: I'm already pretty good at Rust programming. Will I be bored?

A: Implementing a programming language from scratch is a challenging project in any programming language. There are a lot of moving parts, tricky data structures, and various challenges of code organization to be found throughout the project. So, no.

Q: Can I really complete this course if I've never coded Rust before?

A: I think so. To be sure, the first part of the course will be slow going, but all of the code is written from first principles using nothing more than standard library features and no third party dependencies. The code is highly focused on concepts and structure, not looking up the names of commands.

Q: Do you offer any easier courses?

A: The Write a Compiler and SICP courses both cover topics that are related to this course and would serve well as preparation.

Personal Note

I had my first foray into Rust programming in 2018. Although I got some programs to work, I found it to be quite complex and frustrating--something I now attribute to having done too much low-level C programming in a past decade. Although Rust is described as a "systems programming" language, it really requires a different mindset than working in C or any C-like language for that matter.

Flash-forward to 2024, and I find myself thinking about a possible course in Programming Languages--perhaps as an offshoot of my experience teaching PL at Brown in 2023. Typically, a project in such a course would be to implement a minimalistic programming language such as some variant of a Lisp interpreter in a high-level language. However, what if the implementation language itself for such a project was something modern and quite different. That's really the idea for this course--to tackle a well defined project from Programming Languages and use it as a vehicle for learning how to program in a new programming language.

In June 2024, I ran a dry-run of this course and found it to be both quite challenging and enlightening. Further courses in 2025 have only reinforced this. By implementing an interpreter in Rust, you are forced to confront your understanding of how most programming languages work, how Rust works, and how they are different. This definitely filled in a lot of conceptual gaps from my first Rust adventure. Although a week is hardly enough time to become any kind of expert Rust programmer, I think this project planted a lot of good seeds for future work.

--Dave

About the Instructor

This class is led by David Beazley. Although most known for his work in the Python community, Dave was formerly a tenure-track assistant professor in the Department of Computer Science at the University of Chicago where he taught a variety of courses in systems and programming languages. In 2023 and 2024, he taught the Programming Language Design and Implementation course with Shriram Krishnamurthi at Brown University. Dave is also the creator of the PLY and SLY parsing tools for Python. In a previous decade, he also created Swig, a C/C++ compiler for building scripting language extension modules.


Copyright (C) 2005-2025, David Beazley