Finite State Machine Desk Calculator

Python FSM · January 2024 – May 2024

Overview

  • Developed a desk calculator in Python using a deterministic finite automaton (DFA) for lexical analysis and a pushdown automaton (PDA) for parsing and evaluating arithmetic expressions.
  • Tokenized input into numbers, variables, and operators with the DFA, then processed tokens with the PDA based on a defined grammar.
  • Managed variable storage with a symbol table and handled errors for invalid tokens or expressions.
  • Performed stack-based evaluation to compute results.

Media

Screenshot of the finite state machine desk calculator

Skills

Python Lexical Analysis Deterministic Finite Automata Pushdown Automata Parsing Grammar Implementation Automata Theory