diff -r 9b2d128765e1 -r 95eaee695636 handouts/ho05.tex --- a/handouts/ho05.tex Sat Oct 26 00:39:27 2013 +0100 +++ b/handouts/ho05.tex Sat Oct 26 00:49:14 2013 +0100 @@ -198,10 +198,19 @@ \end{center} \noindent -Clearly, this string should clearly be identified as a keyword. The problem is that also the regular expression \textit{IDENT} for identifiers would also match this string. To solve this ambiguity we need to rank our regular expressions. +Clearly, this string should clearly be identified as a keyword. The problem is that also the regular expression \textit{IDENT} for identifiers would also match this string. To overcome this ambiguity we need to rank our +regular expressions. In our running example we just use the ranking + +\[ +\textit{KEYWORD} < \textit{IDENT} < \textit{OP} < \ldots +\] +\noindent +and so on. So even if both regular expressions match in the example above, +we can give the regular expression for \ref{Page ??} as follows - +Let us see how our algorithm for lexing works in detail. The regular +expressions and their ranking are shown above. \end{document} %%% Local Variables: