Skip to main content

Crusty Interpreter

33h 53m 10s
English
Paid

Course Description: This course challenges you to implement an interpreter for an unfamiliar programming language (Lox) using a potentially new programming language (Rust), inspired by a book originally authored in a familiar language (Java).

General Overview

In university, you might have encountered assignments like "design a processor's instruction set," "build a Unix shell from scratch," or "solve the Dirac equation" on the first day. While some students shy away, others embrace the challenge. This course belongs to that challenging category.

You will dive into Robert Nystrom's "Crafting Interpreters" book and embark on implementing a lexer and a recursive descent parser. This will likely be your first experience with Rust, with challenges only intensifying thereafter.

Target Audience

This course is intended for seasoned developers eager to elevate their skills through intensive project work using a modern programming language. You might relate to one of these profiles:

  • You've written some Rust and wish to move beyond basic examples with a complex, multi-component project.
  • You have no Rust experience but are curious about it, confident in your compiler/interpreter skills, and ready for a new challenge.
  • You lack both Rust and interpreter experience, but you have a free week and the willingness to face a profound challenge.

The course is akin to a marathon: you may question your decision mid-way, but completion brings immense satisfaction.

Learning Format

This is a week-long project-intensive course. Each morning begins with discussions on programming language design and Rust implementation. Most of the day is devoted to independent coding, punctuated by brief problem-solving and experience-sharing sessions.

Prerequisites

Participants should be comfortable with fundamental programming concepts such as expressions, operators, variables, control flow, functions, and classes. Experience with interpreter implementation is advantageous but not essential. While prior Rust knowledge is unnecessary, expect a steep learning curve with initial trial and error.

Curriculum

The goal is to navigate the first ten chapters of "Crafting Interpreters," developing an AST-walking interpreter for Lox. You'll explore key programming language implementation concepts:

  • Scanning and lexical analysis
  • Recursive descent parsing
  • Program representation and AST construction
  • Program execution
  • Variables, scope, and environment
  • Control structures like if, while, and for loops
  • Functions, including higher-order functions and closures

Simultaneously, you'll delve into essential Rust development aspects:

  • Project organization in multiple modules
  • String handling
  • Error handling with Option/Result
  • Testing
  • Algebraic data types (struct, enum)
  • Recursive structures (trees, lists)
  • Pattern matching
  • Ownership and borrowing rules
  • Interior mutability

The book provides necessary code snippets in Java, challenging you to translate and implement concepts in Rust. This translation makes course discussions particularly engaging and insightful.

About the Author: David Beazley

David Beazley thumbnail

David Beazley is an independent author, educator, and researcher, widely known for his contributions to the Python community. Early in his career, he worked on high-performance scientific software, leading to the creation of SWIG—a compiler that enabled the integration of C/C++ code with Python and other dynamic languages. In 1999, he wrote Python Essential Reference, the first Python reference book.

From 1998 to 2005, David was an associate professor in the Department of Computer Science at the University of Chicago, where he taught courses on operating systems and networks. Since 2007, he has been developing his own educational project, Dabeaz LLC, humorously calling it a "one-man graduate school."

David is the author of the third edition of Python Cookbook (2013), the book Python Distilled (2021), as well as video courses and numerous well-known presentations ranging from live coding to experiments with WebAssembly. In 2023-2024, he taught a course on programming language design and implementation at Brown University, jointly with Shriram Krishnamurthi.

David holds a Ph.D. in computer science and master's and bachelor's degrees in mathematics.

Watch Online 11 lessons

This is a demo lesson (10:00 remaining)

You can watch up to 10 minutes for free. Subscribe to unlock all 11 lessons in this course and access 10,000+ hours of premium content across all courses.

View Pricing
0:00
/
#1: 001 Day 1 Morning
All Course Lessons (11)
#Lesson TitleDurationAccess
1
001 Day 1 Morning Demo
03:31:34
2
002 Day 1 Afternoon
03:23:52
3
003 Day 2 Morning
01:27:36
4
004 Day 2 Late-Morning
01:51:41
5
005 Day 2 Afternoon
03:21:43
6
006 Day 3 Morning
03:34:18
7
007 Day 3 Afternoon
03:25:26
8
008 Day 4 Morning
03:17:33
9
009 Day 4 Afternoon
03:34:20
10
010 Day 5 Morning
03:39:56
11
011 Day 5 Afternoon
02:45:11
Unlock unlimited learning

Get instant access to all 10 lessons in this course, plus thousands of other premium courses. One subscription, unlimited knowledge.

Learn more about subscription