← All Exercises
Python Recursive Descent Parser
advancedpython
Background
Recursive descent parsing is a top-down parsing technique used in compilers, interpreters, and expression evaluators.
Problem
Write a parser that evaluates arithmetic expressions containing +, -, *, /, and parentheses using recursive descent parsing.
Input
A string containing an arithmetic expression.
Output
The numeric result of evaluating the expression.
Sample tests
Sample 1
Input: "2 + 3 * 4"
Expected: 14
Your solution
Learning objective
Learn recursive descent parsing, operator precedence, and grammar rule implementation.