Overview of the Create Your Own Programming Language with Rust book
masterThis book provides a structured path for building programming languages using Rust, progressing through four distinct stages of complexity:
- Part I: Calculator - Focuses on the fundamentals: grammar, lexing, parsing, Abstract Syntax Trees (AST), interpreters, Virtual Machines (VM), bytecode, and JIT compilation using LLVM.
- Part II: Firstlang (Interpreted) - Transitions from a calculator to a real language with Python-like syntax, supporting variables, functions, control flow (if/else, while), and recursion via an interpreter.
- Part III: Secondlang (Compiled) - Evolves the language into a compiled language by adding type annotations, type inference, AST optimizations using the Visitor pattern, Intermediate Representation (IR), and LLVM code generation.
- Part IV: Thirdlang (Object-Oriented) - Adds object-oriented capabilities including class syntax, constructors, methods,
self, and memory management, along with advanced LLVM IR optimization.
The book also covers practical aspects like building a REPL, debugging, and testing your language.