As the title suggests, is this possible? Or does it halt execution when it hits the trap state? Thanks to anyone who can clear this up.
A deterministic finite automaton can only go to infinite loop if the input string is infinite. For finite inputs, the automaton stops when the input string ends. For infinite inputs, for example the automaton for regex
0*1 will loop infinitely if the input string is an infinite sequence of
The DFA performs a single state transition on each read input symbol, reads each symbol of the input exactly once, and halts when the input string is exhausted. In order for an infinite loop of state transitions to happen, the input string has to be infinite. DFAs are usually defined for finite inputs only, as the automaton's output is defined by what state the automaton is in after the input string has been exhausted (something that will never happen for infinite strings).
However, the concept of the DFA has been generalized in a way it can be applied to infinite input strings as well: the omega automata (often written as ω-automata) will accept a string if the entire execution fulfills some acceptance condition. A typical example is the Büchi automaton, which functions otherwise as a normal DFA or NFA, but only accepts input strings that cause the automaton to be in an accepting state infinitely often.