coursework/cw02.tex
changeset 578 e3cb8adb2a92
parent 567 a48605bdf467
child 598 278b8b05f286
equal deleted inserted replaced
577:1d6043a87a3e 578:e3cb8adb2a92
   170 
   170 
   171 Extend your lexer from Q2 to also simplify regular expressions
   171 Extend your lexer from Q2 to also simplify regular expressions
   172 after each derivation step and rectify the computed values after each
   172 after each derivation step and rectify the computed values after each
   173 injection. Use this lexer to tokenize the programs in
   173 injection. Use this lexer to tokenize the programs in
   174 Figure~\ref{fib} and \ref{loop}. Give the tokens of these
   174 Figure~\ref{fib} and \ref{loop}. Give the tokens of these
   175 programs where whitespaces are filtered out.
   175 programs where whitespaces are filtered out.\bigskip
   176 
   176 
   177 
   177 
   178 \begin{figure}[p]
   178 \begin{figure}[h]
   179 \mbox{\lstinputlisting[language=while]{../progs/fib.while}}
   179 \mbox{\lstinputlisting[language=While,xleftmargin=10mm]{../progs/fib.while}}
   180 \caption{Fibonacci program in the WHILE language.\label{fib}}
   180 \caption{Fibonacci program in the WHILE language.\label{fib}}
   181 \end{figure}
   181 \end{figure}
   182 
   182 
   183 \begin{figure}[p]
   183 \begin{figure}[h]
   184 \mbox{\lstinputlisting[language=while]{../progs/loops.while}}
   184 \mbox{\lstinputlisting[language=While,xleftmargin=10mm]{../progs/loops.while}}
   185 \caption{The three-nested-loops program in the WHILE language. 
   185 \caption{The three-nested-loops program in the WHILE language. 
   186 Usually used for timing measurements.\label{loop}}
   186 (Usually used for timing measurements.)\label{loop}}
   187 \end{figure}
   187 \end{figure}
   188 
   188 
   189 \end{document}
   189 \end{document}
   190 
   190 
   191 %%% Local Variables: 
   191 %%% Local Variables: