How rnks2003/exp_dfa works
File Structure
• Top-level files:
• main.py – the Streamlit app entry point (UI + business logic)
• requirements.txt – lists Python dependencies
• .streamlit/config.toml – optional Streamlit deployment/config settings
• readme.md, .gitignore – docs and version control
• No separate “frontend” and “backend” folders: Streamlit handles UI and server logic in a single process.
Key Components
a. Streamlit UI Layer
• Renders controls: state-creator widgets, symbol inputs, buttons
• Displays graphs and tables in the user’s browser
b. DFA Builder & Validation Engine
• In-memory model of states, alphabet, transition functions
• Validates well-formedness (one transition per symbol, start/accept marked)
c. Simulation Engine
• Performs step-by-step or full-string DFA traversal
• Implements wildcard logic for ? and *
d. Visualization Subsystem
• NetworkX builds the underlying graph structure
e. Data Presentation Layer
• Pandas DataFrame for transition tables
• Streamlit’s UI components for tables
f. Deployment/Runtime Environment
• Local Python environment or Streamlit Cloud
• Dependencies managed via requirements.txt
Relationships and Data Flow
• User (Browser) interacts with Streamlit UI →
• Streamlit server (main.py) invokes:
• DFA Builder → Validation → Simulation →
• Visualization (NetworkX + Matplotlib) →
• DataFrame rendering (Pandas) →
• Results are streamed back to the browser UI
• Configuration (.streamlit/config.toml) influences app settings (theme, port)
Architectural Patterns & Principles
• Component layering: UI, business logic (builder & simulator), visualization, and data presentation
• Single-process, event-driven architecture inherent to Streamlit
• Stateless between runs, state held in Streamlit’s session state
• Modular code separation: functions or classes in main.py for each subsystem