Generating a lexical analyzer algorithm is as follows:
RE: Regular Expressions
NFA: nondeterministic finite automaton
DFA: deterministic finite automaton
Thompson algorithm:
Thompson algorithm using regular expressions from the code to the NFA (limited non-deterministic finite state machine) process
Based structure for the induction of RE
- The basic structure of RE direct
- RE composite of recursive construction
For example: are several regular expression rules
When the process enters the state transition, it reads the first character string, verifies
- [epsilon] (null character "")
- E (character e "e")
- e1 e2
- e1 | e2
- e*
When entering a rule as described above in accordance with the regular expression: a (a | b) *