In this book we will walk through the basics of interpreted language implementation in Rust with a focus on the challenges that are specific to using Rust.
At a glance, these are:
- A custom allocator for use in an interpreter
- A safe-Rust wrapper over allocation
- A compiler and VM that interact with the above two layers
The goal of this book is not to cover a full featured language but rather to provide a solid foundation on which you can build further features. Along the way we'll implement as much as possible in terms of our own memory management abstractions rather than using Rust std collections.
Bob Nystrom's Crafting Interpreters is recommended introductory reading to this book for beginners to the topic. Bob has produced a high quality, accessible work and while there is considerable overlap, in some ways this book builds on Bob's work with some additional complexity, optimizations and discussions of Rust's safe vs unsafe.
We hope you find this book to be informative!
All the links below are acknowledged as inspiration or prior art.
- Richard Jones, Anthony Hosking, Elliot Moss - The Garbage Collection Handbook
- Stephen M. Blackburn & Kathryn S. McKinley - Immix: A Mark-Region Garbage Collector with Space Efficiency, Fast Collection, and Mutator Performance
- Felix S Klock II - GC and Rust Part 0: Garbage Collection Background
- Felix S Klock II - GC and Rust Part 1: Specifying the Problem
- Felix S Klock II - GC and Rust Part 2: The Roots of the Problem