A recursive-descent math expression parser and evaluator written in C.
- Parses and evaluates arithmetic expressions:
+,-,*,/ - Correct operator precedence (multiplication/division before addition/subtraction)
- Parentheses support:
(3 + 2) * 4 - Whitespace-tolerant input via
trim() - Builds an AST (abstract syntax tree) and resolves it recursively
Instead of manually free()ing the AST nodes, the evaluator runs inside a forked child process. All malloc allocations are cleaned up automatically when the child calls exit(0), relying on the OS to reclaim the memory. The parent simply calls wait(NULL) to collect the child.
make # compila
make run # compila e executa
make clean # remove o binário