Python’s flexible syntax and metaprogramming capabilities make it ideal for hosting domain-specific languages (DSLs): they can dramatically simplify development in a specific domain, and because they are native to Python, they can seamlessly reuse the entire ecosystem. This talk teaches you how to implement a Python DSL. Using a card-game DSL written from scratch as the example, we will walk through the complete pipeline — from frontend code capture, IR design and lowering, to optimization passes and backend generation.