PDA_SIMULATOR / README.md
ministerchief's picture
Update README.md
7132387 verified
|
Raw
History Blame Contribute Delete
1.86 kB

A newer version of the Gradio SDK is available: 6.25.0

Upgrade
metadata
license: mit
title: PDA_SIMULATOR
sdk: gradio
emoji: πŸ’»
colorFrom: yellow
colorTo: indigo
pinned: false

PDA Simulator – Theory of Computation Visual Tool

A presentation-style, interactive web application for simulating Pushdown Automata (PDA) β€” built with Flask, HTML, CSS, and JavaScript.


πŸš€ How to Run

1. Clone / Download the project

pda_simulator/
β”œβ”€β”€ app.py
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ static/
β”‚   β”œβ”€β”€ style.css
β”‚   └── script.js
└── templates/
    └── index.html

2. Create a virtual environment (recommended)

cd pda_simulator
python -m venv venv

# Windows
venv\Scripts\activate

# macOS / Linux
source venv/bin/activate

3. Install dependencies

pip install -r requirements.txt

4. Run the Flask app

python app.py

5. Open in browser

http://127.0.0.1:5000

🎯 Features

  • Three sample PDAs: aⁿbⁿ, Balanced Parentheses, wcwα΄Ώ
  • Step-by-step simulation with Prev / Next / Auto-Play / Pause
  • SVG state diagram with active state and transition highlighting
  • Stack visualizer showing push/pop at each step
  • Input tape with position pointer
  • Acceptance by Final State or Empty Stack
  • Toast error messages for invalid PDA definitions
  • Modern dark sci-fi UI with glassmorphism cards

πŸ“– Transition Format

current_state, input_symbol, stack_top -> next_state, push_value
  • Use Ξ΅ (or eps) for epsilon transitions
  • Example:
    q0, a, Z -> q0, AZ
    q0, b, A -> q1, Ξ΅
    q1, Ξ΅, Z -> q2, Z
    

πŸ›  Tech Stack

Layer Technology
Backend Python 3 + Flask
Frontend HTML5 + CSS3 + Vanilla JS
Diagram SVG (drawn with JavaScript)
Fonts Google Fonts (Orbitron, Space Mono, Inter)