The Interpreter
Parsing the precursor grammar of the deep Bell Labs archives.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Interpreter
ARCANUM SCHOOL: Divination // Comprehension
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// B PATTERN //
/* The simplest recursive descent over untyped arrays */
ext expression_ptr;
match(c) {
if (*expression_ptr == c) {
expression_ptr = expression_ptr + 1;
return 1;
}
return 0;
}
interpret_rune() {
if (match('A')) { putchar('1'); return; }
if (match('B')) { putchar('2'); return; }
}
decipher() {
auto script[3];
script[0] = 'A'; script[1] = 'B'; script[2] = 0;
expression_ptr = script;
interpret_rune();
interpret_rune();
}
Runic Tags:
#b
#design-pattern
#precursor
#bell-labs-magic
#untyped