250 likes | 378 Vues
This document provides an in-depth simulation of a Non-deterministic Finite State Automaton (NFSA) utilizing a double-ended queue (deque) structure for input processing. It illustrates the step-by-step transitions through various states based on different input sequences, particularly focusing on the handling of label matches and mismatches. The simulation captures the dynamics of pushing and enqueuing operations alongside the acceptance conditions for each processing state. Each transition is annotated with visual state labels for clarity.
E N D
NFSA Simulation with Deque Deque Input Text a a a -1 a a a a a a a a a a a a a b d a top bottom state label a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a 6 a 3 a -1 a a a a a a a a a a a a a b d a top bottom Push 3 and 6 since label = state 10 label a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 3 -1 7 a a a a a a a a a a a a a b d a top bottom Enqueue 7 since label matches state 6 label a a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a 4 a 1 3 -1 7 a a a a a a a a a a a a b d a top bottom Push 1 and 4 since label = state 3 label a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 1 -1 7 a a a a a a a a a a a a b d a top bottom Do nothing since label mismatches state 4 label b a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 1 -1 7 2 a a a a a a a a a a a a b d a top bottom Enqueue 2 since label matches state 1 label a a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 1 -1 7 2 a -1 a a a a a a a a a a b d a top bottom Enqueue -1 and advance input state -1 label a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 1 -1 7 2 -1 a a a a a a a a a a b d a top bottom Enqueue -1 and advance input state -1 label a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 1 -1 8 7 2 -1 a a a a a a a a a a b d a top bottom Push 8 since label = state 7 label a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 1 -1 7 2 -1 a a a a a a a a a a b d a top bottom Do nothing since label mismatches state 8 label c a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 1 -1 7 3 2 -1 a a a a a a a a a a b d a top bottom Push 3 since label = state 2 label a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 1 -1 4 7 1 2 -1 a a a a a a a a a a b d a top bottom Push 1 and 4 since label = state 3 label a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 1 -1 7 1 -1 a a a a a a a a a a b d a top bottom Do nothing since label mismatches state 4 label b a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 1 -1 7 1 -1 2 a a a a a a a a a a b d a top bottom Enqueue 2 since label matches state 1 label a a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 1 -1 7 1 -1 2 -1 a a a a a a a a a b d a top bottom Enqueue -1 and advance input state -1 label a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 1 -1 7 1 -1 3 2 -1 a a a a a a a a b d a top bottom Push 3 since label = state 2 label a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 1 -1 7 1 4 -1 1 2 -1 a a a a a a a a b d a top bottom Push 1 and 4 since label = state 3 label a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 1 -1 7 1 -1 1 -1 5 a a a a a a a a b d a top bottom Enqueue 5 since label matches state 4 label a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 1 -1 7 1 -1 1 -1 5 a a a a a a a b d a top bottom Do nothing since label mismatches state 1 label a a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 1 -1 7 1 -1 1 -1 5 a -1 a a a a a a b d a top bottom Enqueue -1 and advance input state -1 label a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 1 -1 7 1 -1 1 -1 11 5 -1 a a a a a a b d a top bottom Push 11 since label = state 5 label a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 1 -1 7 1 -1 1 -1 12 5 -1 a a a a a a b d a top bottom Push 12 since label = state 11 label a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 1 -1 7 1 -1 1 -1 5 -1 13 a a a a a a b d a top bottom Enqueue 13 since label matches state 12 label d a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 1 -1 7 1 -1 1 -1 5 -1 13 a -1 a a a a b d a top bottom Enqueue -1 and advance input state -1 label a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5
NFSA Simulation with Deque Deque Input Text a a 1 -1 7 1 -1 1 -1 5 -1 -1 a a a a b d a top bottom STOP: match found state 13 label a c 6 7 8 9 d 10 11 12 13 start accept a b 1 2 3 4 5