Lexical Finite Automata


- normal state: copy a character to a token buffer
- accept state: return a token & go back to intial state
- “error” state: report an error & stop

to make a finite automata as a code we need
- state
- lookahead() - just look
- next() - next character
- return token
- report error (there is error state)
- while lookahead() ≠ EOF
- case per state




1. Regex to DFA separately
2. Combine DFAs to NFA
3. NFA to DFA conversion
4. Adjust DFA





