Regular expression matching: Theory and Implementation

Introduction The first step in building a compiler would be to build a lexical analyzer, shortened to &rsquo;lexer&rsquo;. To define what a lexer does we may understand it as a function: $$\text{Lexer :: string} \to [\text{token}]$$ Where a token can be thought of as the tuple $\text{token} = \langle \text{class, string} \rangle$. A token class, loosely speaking, corresponds to a set of strings.…