cws/cw03.tex
changeset 942 7f52427568ff
parent 901 01b481e47887
child 949 58720903336e
equal deleted inserted replaced
941:38456acd29f3 942:7f52427568ff
    13 16:00. You are asked to implement a parser for the WHILE language and
    13 16:00. You are asked to implement a parser for the WHILE language and
    14 also an interpreter. You can do the implementation in any programming
    14 also an interpreter. You can do the implementation in any programming
    15 language you like, but you need to submit the source code with which
    15 language you like, but you need to submit the source code with which
    16 you answered the questions, otherwise a mark of 0\% will be
    16 you answered the questions, otherwise a mark of 0\% will be
    17 awarded. You should use the lexer from the previous coursework for the
    17 awarded. You should use the lexer from the previous coursework for the
    18 parser.  Please package everything(!) in a zip-file that creates a
    18 parser.  Please submit your code to Github by the deadline.
    19 directory with the name \texttt{YournameYourFamilyname} on my end.
       
    20 
    19 
    21 \subsection*{Disclaimer\alert}
    20 \subsection*{Disclaimer\alert}
    22 
    21 
    23 It should be understood that the work you submit represents your own
    22 It should be understood that the work you submit represents your own
    24 effort. You have not copied from anyone else. An exception is the
    23 effort. You have not copied from anyone else. An exception is the
   160 \begin{figure}[p]
   159 \begin{figure}[p]
   161 \lstinputlisting[language=while,xleftmargin=0mm]{../cwtests/cw03/collatz2.while}
   160 \lstinputlisting[language=while,xleftmargin=0mm]{../cwtests/cw03/collatz2.while}
   162 \caption{Collatz series program.\label{collatz}}
   161 \caption{Collatz series program.\label{collatz}}
   163 \end{figure}
   162 \end{figure}
   164 
   163 
       
   164 \clearpage
       
   165 \newpage
       
   166 \section*{Answers}
       
   167 
       
   168 \noindent
       
   169 \textbf{Question 1 (Grammar):}\\
       
   170 
       
   171 \mbox{}\\[9cm]
       
   172 
       
   173 \noindent
       
   174 \textbf{Question 2 (Prase Tree):}\\
       
   175 
       
   176 \mbox{}\\[8cm]
       
   177 
       
   178 
       
   179 \noindent
       
   180 \textbf{Question 3 (Timings):}\\
       
   181 
       
   182 \begin{center}
       
   183   \def\arraystretch{1.5}
       
   184   \begin{tabular}{l|l}
       
   185     n & secs\\
       
   186     \hline
       
   187     100 & \\
       
   188     500 & \\
       
   189     700 & \\
       
   190     1000 & \\
       
   191     \\
       
   192     \\
       
   193     \\
       
   194     \\
       
   195    \end{tabular} 
       
   196 \end{center}  
       
   197 
   165 \end{document}
   198 \end{document}
   166 
   199 
   167 %%% Local Variables: 
   200 %%% Local Variables: 
   168 %%% mode: latex
   201 %%% mode: latex
   169 %%% TeX-master: t
   202 %%% TeX-master: t