Build a Rule Engine

Interpreter pattern

Challenge 4 of Actions as ObjectsAdvanced~60 minFree

Build a boolean rule / feature-flag engine using the Interpreter pattern: represent a small grammar as a tree of expression objects, each with an interpret(context) method that evaluates the rule against a context dict.

5 steps

  1. 1Terminal Expressions
  2. 2Boolean Composites
  3. 3Negation
  4. 4Comparison Terminal
  5. 5Compose a Real Rule
Start step 1