Crusty Interpreter

Source: https://www.dabeaz.com/crusty.html

General Overview

Sometimes at university, there were courses where the instructor would give out a modest assignment like “design the architecture of a processor’s instruction set,” “implement a Unix shell from scratch,” or “solve the Dirac equation” on the very first day. Some students would try to run away, while others would smile as if to say, “go ahead, give it a try.” This course falls into that same category.

Starting from scratch, you will dive into Robert Nystrom’s book “Crafting Interpreters” and be tasked with implementing a lexer and a recursive descent parser — and this will be your first experience with Rust. The difficulty only escalates from there.

Target Audience

The course is designed for experienced developers who want to enhance their skills by working on a meaningful and intensive project using a modern programming language. Perhaps you recognize yourself in one of these descriptions:

  • You have written a bit in Rust and want to move beyond simple examples by tackling a project with multiple components.
  • You have never worked with Rust, but you are curious. You have experience creating interpreters or compilers, and you are confident you can dive into deep waters.
  • You have never written in Rust or worked on interpreters at all, but you have a whole week, no other commitments, and the desire to take on a serious challenge.

The course is truly challenging, like a marathon: during the process, you’ll find yourself thinking “what have I gotten myself into?” but finishing will bring genuine satisfaction.

Learning Format

This is a week-long project-intensive course. Each morning begins with discussions on topics related to programming language design and their implementation in Rust. Most of the time is dedicated to independent code work. Throughout the day, there will be short sessions to address problems and share experiences.

Prerequisites

Confidence in basic programming language concepts is required: expressions, operators, variables, control flow, functions, and classes. Experience in implementing an interpreter in any language is useful but not mandatory. Knowledge of Rust is not assumed, but you must be ready for a very fast-paced learning experience. Rust is a challenging language, so expect a lot of trial and error initially.

Curriculum

The main goal is to cover the first ten chapters of the book “Crafting Interpreters,” creating an AST-walking interpreter for the Lox language. Key aspects of programming language implementation will be studied in the process:

  • Scanning and lexical analysis.
  • Parsing using recursive descent.
  • Program representation and AST construction.
  • Program execution.
  • Variables, scope, and environment.
  • Control structures (if, while, for).
  • Functions, including higher-order functions and closures.

Simultaneously, you’ll get acquainted with important aspects of Rust development:

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

The book provides all necessary code snippets, but they are written in Java and often use idioms that do not have direct analogs in Rust. A significant part of the challenge lies in understanding the concept and implementing it correctly. This, however, makes course discussions particularly productive.

005 Day 2 Afternoon mp4 0000

005 Day 2 Afternoon mp4 0001

005 Day 2 Afternoon mp4 0002

005 Day 2 Afternoon mp4 0003



Download Links

Password: cms.ddpanda.org

Could not retrieve data for: <a href="https://krakenfiles.com/view/4rhpijo2N7/file.html" target="_blank" rel="noopener noreferrer nofollow">https://krakenfiles.com/view/4rhpijo2N7/file.html</a>

Enjoyed this post?

If this article helped you, consider supporting my work.

Support 🐼

Leave a Reply

Your email address will not be published. Required fields are marked *