Interpreter in Dhall
Parse and evaluate abstract runic syntax trees with total functional guarantees.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Interpreter
ARCANUM SCHOOL: Divination // Linguistics
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// DHALL PATTERN //
let Expr = < Lit : Natural | Add : { left : Natural, right : Natural } >
let interpret = \(e : Expr) ->
merge
{ Lit = \(n : Natural) -> n
, Add = \(args : { left : Natural, right : Natural }) -> args.left + args.right
}
e
in interpret (Expr.Add { left = 2, right = 3 })
Dhall shines brightly when hosting an Interpreter. Since the language forbids non-terminating loops, any syntax tree defined and evaluated inside Dhall is fundamentally safe. The interpreter collapses custom symbolic expressions into tangible results via exhaustive pattern matching.
Runic Tags:
#dhall
#halting
#runes
#configuration
#behavioral