The Interpreter
Deciphering the grammatical syntax of runic languages.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Interpreter
ARCANUM SCHOOL: Divination // Subschool: Linguistics
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// OBJC PATTERN //
@protocol TKRuneExpression <NSObject>
- (BOOL)interpret:(NSString *)context;
@end
@interface TKTerminalRune : NSObject <TKRuneExpression>
@property (nonatomic, strong) NSString *data;
- (instancetype)initWithData:(NSString *)data;
@end
@implementation TKTerminalRune
- (instancetype)initWithData:(NSString *)data {
if (self = [super init]) { _data = data; }
return self;
}
- (BOOL)interpret:(NSString *)context {
return [context containsString:self.data];
}
@end
Interpreter binds an abstract syntax tree of runes. By parsing the tree, ancient NeXTSTEP compilers divine the meaning of complex magical phrases.
Runic Tags:
#objc
#interpreter
#behavioral