Gof Interpreter

Interpreter in modern Java: representing a small language as a typed tree and evaluating it, expressed today as a sealed AST with an exhaustive switch rather than an eval() method per node. Covers parsing as a separate problem the pattern does not solve, when an existing expression language beats writing one, how general expression engines become code-execution surfaces when exposed with unsafe capabilities, the resource bounds an interpreter over untrusted input needs, and closure compilation when tree walking is too slow. Use when a filter, rule or formula language is designed, when configuration has grown conditionals, when someone proposes embedding an expression evaluator, or when an expression from a request is passed to a template or EL engine. Does not cover adding operations over an existing tree (gof-visitor), the tree structure itself (gof-composite), query specifications over a database (query-objects-and-specifications), or JIT compilation of Java (jit-compilation).

robsonkades Updated

File contents

robsonkades/agent-skills/tree/main/skills/gof-interpreter commit 1328aa2ef7

Frequently asked questions

npx skillmds@latest add robsonkades/gof-interpreter