Language: Python · Sphere: programming · Category: Reasoning
Simple Expression Evaluator with Variables
This module provides a complete expression evaluator that supports:
- Basic arithmetic operations (+, -, *, /, %, **)
- Parentheses for grouping
- Variables with assignment and lookup
- Integer and floating-point numbers
When it runs, expression evaluator guarantees got == expected; ev.evaluate('x = 10') == 10; ev.evaluate('y = 5') == 5 (proven by run).
Checkable constraints:
got == expectedtype(got) is type(expected)ev.evaluate('x = 10') == 10ev.evaluate('y = 5') == 5ev.evaluate('x + y') == 15ev.evaluate('z = x * y') == 50ev.evaluate('z') == 50ev.evaluate('x = -7') == -7
- Green-run: ✓ passes (re-run under the extractor's gate)
- Constraint strength: recovery (truth-pinned)
- Independent oracle: ✓ consensus — xlang (validator v1.9)
- Peer review: unreviewed
△ AURA Pattern Library — © Reality Optimizer