Demystifying compilers by writing your own
summary
A small compiler implemented in Elixir translates a Ragnarok/OpenKore macro language into runtime code for the bot system; source code and a live asciinema show it working. It uses a parser built with Elixir parsing tools (no separate tokenization), builds an AST, a symbol table for semantic checks, and applies two concrete optimizations — constant folding and dead-store elimination — before code generation into the target plugin format. The tool compiles, runs in demos, and the repo shows how to add new commands.
AI-written summary · about
chapters (12)
- 0:00Introduction to compilers
- 3:27Why build a compiler
- 8:27Compiler design basics
- 10:14Writing a simple compiler
- 15:16Code generation process
- 17:45Compiler optimization
- 23:49Parsing techniques
- 27:05Evaluating code blocks
- 30:16Error handling in compilers
- 32:25Optimization techniques
- 35:44Generating final code
- 37:10Summary and resources
related talks
46mBuild Your Own Elixir
23mMacro-embedding Compiler Intermediate Languages in Racket
01h 04mClojure Compilation, Backwards
01h 16m“What Has My Compiler Done for Me Lately? Unbolting the Compiler's Lid”
35mThe pillars of Metaprogramming in Elixir
40mJoy of Meta-Tracing Just-in-Time Compilation: More Than Just a VM Generator
30mExploring Elixir Project Re compilation
40mYour Program as a Transpiler: Applying Compiler Design to Everyday Programming
