diff -r 5deefcc8cffa -r e3acf2bf3895 coursework/cw03.tex --- a/coursework/cw03.tex Tue Sep 20 12:24:29 2016 +0100 +++ b/coursework/cw03.tex Tue Sep 20 12:25:09 2016 +0100 @@ -4,9 +4,9 @@ \begin{document} -\section*{Coursework 3 (Strand 1)} +\section*{Coursework 3} -\noindent This coursework is worth 5\% and is due on 27 +\noindent This coursework is worth 5\% and is due on 24 November at 16:00. You are asked to implement a parser for the WHILE language and also an interpreter. You can do the implementation in any programming language you like, but you @@ -23,9 +23,9 @@ CW~1 and CW~2. -\subsection*{Question 1 (marked with 1\%)} +\subsection*{Question 1} -Design a grammar for the WHILE language and give the grammar +Design a grammar for the WHILE language and give the grammar rules. The main categories of non-terminal should be: \begin{itemize} @@ -39,12 +39,12 @@ \item blocks which are enclosed in curly parentheses \end{itemize} -\subsection*{Question 2 (marked with 2\%)} +\subsection*{Question 2} You should implement a parser for the WHILE language using parser combinators. Be careful that the parser takes as input a stream, or list, of tokens generated by the tokenizer from -the previous coursework. For this you might filter out +the previous coursework. For this you might want to filter out whitespaces and comments. Your parser should be able to handle the WHILE programs in Figures~\ref{fib} and \ref{loop}. In addition give the parse tree for the statement: @@ -81,11 +81,11 @@ \caption{The datatype for parse trees in Scala.\label{trees}} \end{figure} -\subsection*{Question 3 (marked with 2\%)} +\subsection*{Question 3} Implement an interpreter for the WHILE language you designed and parsed in Question 1 and 2. This interpreter should take -as input a parse tree. However be careful because programs +as input a parse tree. However be careful because, programs contain variables and variable assignments. This means you need to maintain a kind of memory, or environment, where you can look up a value of a variable and also