How to understand modern C++ features in practice? Let's create a compiler!
summary
A small but complete FORTH compiler-interpreter is implemented in modern C++ and actually builds and runs; the project uses std::ranges and coroutines for token parsing, generators and a coroutine-based cooperative scheduler (semi‑fibers) to avoid heavyweight context switches, and organizes code with modules. Port to RISC‑V ESP32 shows a full image around 750 KB with room for trimming. The claim is practical: coroutine-based multitasking measures significantly lower overhead than thread RTOS-style context switching, and the implementation, parsing, and embedded port all work end-to-end.
AI-written summary · about
chapters (27)
- 0:00Introduction
- 1:06Forth language choice
- 3:59Forth core concepts
- 6:50Forth stack in C++
- 9:00Stack memory management
- 10:50Stack wrappers with mixins
- 11:53Forth word dictionary
- 13:15Custom Forth words
- 14:20Forth interpreter architecture
- 16:49Coroutines in C++
- 20:05Cooperative multitasking
- 22:38Coroutine basics
- 26:08Coroutine lifecycle
- 31:28Cooperative fibers
- 33:35Minimal coroutine framework
- 36:04Chrono in coroutines
- 37:50Coroutine scheduler
- 38:55Coroutines in Forth
- 40:45C++20 ranges for tokens
- 44:22Token stream with ranges
- 46:35Modern C++ features
- 47:17Memory optimization with no_unique_address
- 49:50Bit manipulation
- 51:41Uninitialized objects
- 53:05Porting to embedded
- 55:37Key takeaways
- 57:07Q&A
related talks
01h 00mModern C++: C++ Patterns to Make Embedded Programming More Productive
55mC++ in the World of Embedded Systems
01h 03mHow C++20 changes the way we write code
01h 00mTeaching old compilers new tricks
55mHow bad is meta-programming still today?
01h 36mPlenary: Cooperative C++ Evolution - Toward a Typescript for C++
01h 16mPaying for Lunch: C++ in the ManyCore Age
23mFunctional Programming in C++ (Run time vs Compile time types)
