--- 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) ```bash cd pda_simulator python -m venv venv # Windows venv\Scripts\activate # macOS / Linux source venv/bin/activate ``` ### 3. Install dependencies ```bash pip install -r requirements.txt ``` ### 4. Run the Flask app ```bash 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) |