⚙️ MIRANDA RUNE DIFFICULTY: Archmage Behavioral

The Interpreter of the Ancestral Monad

Evaluating an abstract syntax tree of pure monadic expressions.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Interpreter
ARCANUM SCHOOL: Enchantment // Ancestral Monad
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// MIRANDA PATTERN //
|| The Interpreter evaluates the true language of the Ancestral Monad.

expr ::= Val num | Add expr expr | Mul expr expr

interpret :: expr -> num
interpret (Val n) = n
interpret (Add a b) = interpret a + interpret b
interpret (Mul a b) = interpret a * interpret b

sacred_expression :: expr
sacred_expression = Mul (Add (Val 2) (Val 3)) (Val 4)

result :: num
result = interpret sacred_expression
Runic Tags: #miranda #behavioral #interpreter #ancestral-monad