| fifth.py | ||
| README.md | ||
Fifth
A simple stack-based language called Fifth
Usage
python fifth.py
Commands
PUSH <n>- push integer onto stackPOP- remove top elementSWAP- swap top two elementsDUP- duplicate top element+,-,*,/- arithmetic operationsEXIT- quit
Example
stack is: []
PUSH 10
stack is: [10]
PUSH 5
stack is: [10, 5]
+
stack is: [15]
PUSH 45
stack is: [15, 45]
/
stack is: [3]
EXIT
Tests
python -m pytest test_stack_calculator.py
Requirements
- Python 3.10+