coursework/cw02.tex
changeset 578 6e5e3adc9eb1
parent 567 4573d36d0b2f
child 598 e3ad67cd5123
equal deleted inserted replaced
577:7a437f1f689d 578:6e5e3adc9eb1
   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: