Introduction – Create Your Own Programming Language with Rust
4 months ago
- #rust
- #compilers
- #programming-languages
- Materials distributed under Creative Commons BY-NC-SA 4.0 license.
- Motivation: Frustration over lack of modern, clear, and concise materials for beginners to create their own programming language.
- Pedagogical approach: Co-creating interactively with the simplest example (calculator language) to build knowledge and confidence.
- Prerequisites: Basic knowledge of Rust; official Rust book recommended for beginners.
- Projects include Calculator, Firstlang (stable Rust), Secondlang, and Thirdlang (nightly Rust + LLVM).
- Learning progression from Calculator (18-line grammar) to Thirdlang (140-line grammar), adding features like variables, functions, types, and OOP.
- Calculator focuses on fundamentals: grammar, AST, and multiple backends (interpreter, VM, JIT).
- Firstlang introduces statements, functions, control flow, and recursion with a tree-walking interpreter.
- Secondlang adds static types, type inference, and compiles to native code via LLVM.
- Thirdlang introduces OOP features: classes, methods, constructors, and memory management.
- Outline includes crash course on computing, detailed parts on each language, and culminates in complex features like memory management.