Build a Safe Expression Evaluator for a Math-Learning App
Overview
What this challenge is about.
Build a safe expression evaluator for a math app: write a tokenizer, parser, and evaluator in Python. Pass the test suite to earn a verifiable certificate.
The scenario
The company is a roughly 18-person education-technology startup in Lisbon building an interactive math-learning app for high-school students, where the core loop depends on safely evaluating math expressions that students type directly into the interface.
The Brief
What you'll do, and what you'll demonstrate.
Replace an unsafe expression evaluator that ran student-typed text as live code with a recursive-descent parser and tree-walking evaluator that computes valid math correctly and rejects malicious input, without any dynamic code execution.
Earning criteria — what you'll demonstrate
- Translate a written grammar specification into a working recursive-descent parser that respects operator precedence and associativity.
- Apply higher-order functions to build an extensible operator and function registry that decouples evaluation logic from parsing.
- Design a tree-walking evaluator over an abstract syntax tree using recursion.
- Use test-driven development to prove correctness on valid inputs and safe rejection of malicious inputs.
- Articulate a security argument that justifies avoiding dynamic code execution in user-facing software.
Program Fit
Where this fits in your program.
Sharpens the same skills your degree expects you to demonstrate.
Aligned coursework coming soon.
Skills
Skills you'll demonstrate.
Each one shows up on your verified credential.
- Recursion
Apply recursion to solve real industry problems and demonstrate production-level capability.
- Higher Order Functions
Apply higher order functions to solve real industry problems and demonstrate production-level capability.
- Parsing
Apply parsing to solve real industry problems and demonstrate production-level capability.
- Abstraction
Apply abstraction to solve real industry problems and demonstrate production-level capability.
- Python Programming
Apply python programming to solve real industry problems and demonstrate production-level capability.
- Test Driven Development
Apply test driven development to solve real industry problems and demonstrate production-level capability.
Careers
Career paths this challenge builds toward
Completing this challenge demonstrates skills that transfer directly to these roles:
Backend Software Engineer
Building a safe parser and evaluator mirrors real backend work: turning untrusted user input into a structured representation and processing it without exposing the system to injection. This challenge proves you can design clean abstractions and defend them with tests.
This challenge sharpens
- parsing
- abstraction
- test-driven-development
Language Tooling Engineer
Interpreters, linters, and formatters all rest on tokenizing, parsing, and walking syntax trees. Implementing a recursive-descent parser and a tree-walking evaluator from a grammar spec is the foundational skill set for building developer language tools.
This challenge sharpens
- recursion
- parsing
- higher-order-functions
Application Security Engineer
Replacing dynamic code execution with a bounded evaluator and proving rejection of malicious input is core application-security practice. The challenge develops the instinct to treat user input as hostile and to design safe-by-construction interfaces.
This challenge sharpens
- abstraction
- test-driven-development
- python-programming