2dbi
Home/Retool/Implement a Safe Expression Evaluator
RRetool·DSAEngineerTechnical Phone Screen

Implement a Safe Expression Evaluator

Problem

Implement a small, safe evaluator for user-provided expressions (e.g., {{ user.name }} or arithmetic) without using eval — Retool's reactive bindings.

Example

eval("{{a}} + {{b}}", {a:2,b:3}) -> 5

Constraints

  • No arbitrary code execution; handle bad input

What Retool looks for

Reported Retool style. Tokenize/parse and evaluate against a scope; reason about sandboxing.

added 6 days ago
LeadersAccount