⚙️ PURESCRIPT RUNE DIFFICULTY: Archmage Behavioral

The Interpreter of Web Runes

Evaluate strict grammatical syntax of ancient web runes into execution trees.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Interpreter
ARCANUM SCHOOL: Divination // Rune Translation
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// PURESCRIPT PATTERN //
module Arcane.Interpreter where
import Prelude

data ArcaneExpr
  = Rune String
  | Amplify ArcaneExpr
  | Combine ArcaneExpr ArcaneExpr

interpret :: ArcaneExpr -> String
interpret (Rune r) = r
interpret (Amplify expr) = interpret expr <> "++"
interpret (Combine e1 e2) = "(" <> interpret e1 <> " + " <> interpret e2 <> ")"

spellTree :: ArcaneExpr
spellTree = Combine (Amplify (Rune "Ignis")) (Rune "Aqua")
Runic Tags: #behavioral #interpreter #purescript #runes