The Interpreter
Deciphering an ancient arcane language grammatically.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Interpreter
ARCANUM SCHOOL: Divination // Linguistics
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// EXECUTABLE C++ PATTERN //
#include <string>
class Context { public: std::string input; int output = 0; };
class Expression {
public: virtual ~Expression() = default; virtual void Interpret(Context& ctx) = 0;
};
class RuneExpression : public Expression {
public:
void Interpret(Context& ctx) override {
if(ctx.input == "IGNIS") ctx.output += 10;
}
};
Runic Tags:
#behavioral
#interpreter
#cpp