Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available: 6.25.0
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
Ξ΅(oreps) 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) |