Go to file
2025-08-30 11:06:09 +01:00
fifth.py initial 2025-08-30 11:06:09 +01:00
README.md initial 2025-08-30 11:06:09 +01:00

Fifth

A simple stack-based language called Fifth

Usage

python fifth.py

Commands

  • PUSH <n> - push integer onto stack
  • POP - remove top element
  • SWAP - swap top two elements
  • DUP - duplicate top element
  • +, -, *, / - arithmetic operations
  • EXIT - 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+