RPN Command-Line Calculator
A calculator that reads Reverse Polish Notation expressions from the command line or stdin and evaluates them using a manually implemented stack. Learners practice array-based stack implementation, string tokenizing with strtok, and basic arithmetic parsing in C.
- Estimate
- ~6.5h
- Steps
- 5
- Completed by
- 0
- Proposed by
- codeseed.app
stdio.h · stdlib.h · string.h
Project roadmap
- 01
Design the stack data structure
~1hImplement a fixed-size array-based stack with push, pop, and peek functions for double values.
- 02
Tokenize input expressions
~1hUse strtok to split an input line into whitespace-separated tokens (numbers and operators).
- 03
Implement the RPN evaluation loop
~2hFor each token, push numbers onto the stack or pop two operands and apply an operator, pushing the result back.
- 04
Add error handling
~1.5hDetect and report stack underflow, division by zero, and invalid tokens with clear error messages.
- 05
Support interactive and file input modes
~1hLet the program read expressions from stdin interactively or from a file passed as an argument.
Resources
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack