Skip to main content
  1. mtg-compiler/

A symbolic, LLM-facing DSL

Placeholder. Scaffolding for the series. Replace the body with the real write-up.

The typed AST round-trips to a compact symbolic DSL — the surface an LLM generates against, then back to an AST that is guaranteed to parse:

# Oracle text  ->  AST  ->  DSL  (and back)
"Lightning Bolt deals 3 damage to any target."
# ⇣ compile
DealDamage(amount=3, target=AnyTarget())
# ⇣ render
"(deal-damage 3 any-target)"

Because the DSL is a small, closed grammar, generation can be constrained to it — so the model can only emit cards that are well-formed by construction.