We are at the first step of compiler: lexical analysisSource program (a text file, list of characters). Lexical analysis will pick up wordsHow to actually process the regular expressions?: finite automataLexer uses regular expressions for stream of characters to tokens conversion.Quick Refresher (Automata)In automatas, we have only one starting state, which is pointed by an arrowstate machines are very common in video games. For example in Doom’s source code, youcould see the state machine implementation for animationIt literally implements a state machine for each of the objects in the gameFor example: if you are in this state, and, if this happens, go to this stateanimation can be in different states, so the program literally program a state machineIt has very practical rules, so this was why as a programmer it is useful for us.DFA: One state at a time, NFA: Possibly multiple states at a timeYou can always have multiple accepting states (both for DFA and NFA)Regular expressions, NFAs and DFAs are equally powerful.For the same language, you can have any of them.There is provably minimal DFA for a language, although you can have different DFAs torepresent the same language.