
To perform the tokenization of input program, we need to implement lexical analyzer. According to the reference site, https://www.geeksforgeeks.org/compiler-design/introduction-of-lexical-analysis/, DFA, or, Deterministic Finite Automaton seems to be the machine to be used. It takes me back to the college days, I think, the subject was ‘Principles of Compiler Design’ with a book of reference being the one written by Aho, Ullman. DFA seems to be the machine for it. The word ‘deterministic’ indicates that there are no ambiguities in the operation of the machine. There is a symbolic representation of the machine, available if you search. One characteristic of the machine seems to be ‘no memory’, indicating that, no memory is needed for the operation of the machine, like a stack or a list, input comes in and is converted to output, using rules, I think, simple regex rules suffice for the programming languages.
It is interesting to note that, ‘Regular Expression’ is itself classified as DFA.
(𝑄,Σ,𝛿,𝑞0,𝐹) is the 5-tuple that represents this machine. The description can be found on Google. Implementation of a lexical analyzer will fit this machine description.
Q: Set of states, initial state, intermediate states, final state of token table
Σ: alphabet, input character set, a-z, 0-9, other symbols
𝛿: set of rules, regexes
𝑞0: initial state, empty token table
F: final state, output token table




