\begin{frame}{Lexical Analysis} \begin{block}{} \emph{Lexical analysis} converts a sequence of \emph{characters} into a sequence of \emph{tokens}. \end{block} Programs that do lexical analysis are \emph{lexers} or \emph{tokenizers}. \pause \begin{exampleblock}{} For example the expression \begin{talign} \texttt{sum = 15 + 2} \end{talign} could be converted to the sequence of tokens \begin{center} {\renewcommand{\arraystretch}{1} \begin{tabular}{|l|l|} \hline token & token category \\ \hline \texttt{sum} & identifier \\ \hline \texttt{=} & assignment \\ \hline \texttt{15} & integer literal \\ \hline \texttt{+} & operator \\ \hline \texttt{2} & integer literal \\ \hline \end{tabular}} \end{center} \end{exampleblock} Allows to write parsers on the more abstract level of tokens. \end{frame}