Implement an Expression Evaluator Using Recursion and Higher-Order Functions
Overview
What this challenge is about.
Implement in Python (or TypeScript). Build a tokenizer, a recursive-descent parser producing an abstract syntax tree (AST), and a tree-walking evaluator. Use higher-order functions to register operators (a dictionary mapping operator string to a function of left/right). Support arithmetic (+, -, *, /, ^), comparison (<, >, ==, !=), parentheses, unary minus, and 5 named functions (sin, cos, sqrt, abs, max). Build a test suite of 30 cases (provided as input/output pairs) plus 10 'reject malicious input' cases. Deliver source, the test suite, a coverage report, and a 3-page design write-up covering the parser structure and the operator-registry pattern.
The Brief
What you'll do, and what you'll demonstrate.
Build a safe recursive-descent expression evaluator without dynamic code execution, tested against 30 student-input cases plus 10 malicious-input rejections.
Earning criteria — what you'll demonstrate
- Apply recursive-descent parsing to a real grammar
- Use higher-order functions to register operators cleanly
- Reason about abstract-syntax-tree design and tree-walking interpretation
- Test for both correctness and security (malicious-input rejection)
Program Fit
Where this fits in your program.
Sharpens the same skills your degree expects you to demonstrate.
Skills
Skills you'll demonstrate.
Each one shows up on your verified credential.
Careers
Roles this prepares you for.
Real titles. Real skill bridges. Pick the one closest to your trajectory.
Career mappings coming soon.