diff -r be2d568644f6 -r 4a530cad7804 cws/cw04.tex --- a/cws/cw04.tex Wed Sep 17 14:29:52 2025 +0100 +++ b/cws/cw04.tex Wed Sep 17 15:11:48 2025 +0100 @@ -19,7 +19,7 @@ provided by Jasmin or Krakatau (both have a very similar syntax). You can do the implementation in any programming language you like, but you need to submit the source code with -which you answered the questions, otherwise a mark of 0\% will +which you answered the tasks, otherwise a mark of 0\% will be awarded. You should use the lexer and parser from the previous courseworks. Implement your compiler in the file \texttt{cw04.sc}. @@ -145,20 +145,20 @@ %\noindent You need to submit a document containing the answers -%for the two questions below. You can do the implementation in +%for the two tasks below. You can do the implementation in %any programming language you like, but you need to submit the -%source code with which you answered the questions. Otherwise +%source code with which you answered the tasks. Otherwise %the submission will not be counted. However, the coursework %will \emph{only} be judged according to the answers. You can %submit your answers in a txt-file or as pdf.\bigskip -%\subsection*{Question 0 (Unmarked)} +%\subsection*{Task 0 (Unmarked)} % %Please include in the PDF at the beginning your email address, your student %number and whether you are BSc / MSci student and for the latter in which %year your are in. Thanks! -\subsection*{Question 1} +\subsection*{Task 1} You need to lex and parse WHILE programs, and then generate Java Byte Code instructions for the Jasmin assembler (or Krakatau @@ -171,7 +171,7 @@ \caption{The Fibonacci program in the WHILE language.\label{fibs}} \end{figure} -\subsection*{Question 2} +\subsection*{Task 2} Extend the syntax of your language so that it contains also \texttt{for}-loops, like @@ -222,9 +222,9 @@ \end{minipage} \end{center} -\subsection*{Question 3 (OPTIONAL)} +\subsection*{Task 3 (OPTIONAL)} -\noindent In this question you are asked to think about the following +\noindent In this task you are asked to think about the following program: \begin{center} @@ -244,7 +244,7 @@ twice. Therefore you need to make a decision about how it should be compiled? What should the program print? -\subsection*{Question 4} +\subsection*{Task 4} Extend the lexer and parser to add a \textcolor{codepurple}{\pcode{break}} keyword. Modify the compiler (including lexer and parser) such that when a \textcolor{codepurple}{\texttt{break}}-statement is encountered @@ -281,7 +281,7 @@ but not \code{"Should not print"}. For this you need to add a label to the end of every for- and while-loop and also to the end of the whole program just in case you need to jump to that label via a -\code{break}. The file you need to be able to process for this question +\code{break}. The file you need to be able to process for this task is called \texttt{break.while}.