--- a/cws/cw03.tex Thu Dec 01 13:07:32 2022 +0000
+++ b/cws/cw03.tex Fri Dec 02 16:26:20 2022 +0000
@@ -58,15 +58,16 @@
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} -- \ref{collatz}. In addition give the
-parse tree for the statement:
+parse tree according to your grammar for the statement:
\begin{lstlisting}[language=While,numbers=none]
if (a < b) then skip else a := a * b + 1
\end{lstlisting}
\noindent
-A (possibly incomplete) datatype for parse trees in Scala is shown
-in Figure~\ref{trees}.
+The output of the parser is an abstract syntax tree (AST).
+A (possibly incomplete) datatype for ASTs of the WHILE language
+is shown in Figure~\ref{trees}.
\begin{figure}[p]
\begin{lstlisting}[language=Scala]
@@ -95,14 +96,14 @@
case class Lop(o: String, b1: BExp, b2: BExp) extends BExp
// logical operations: and, or
\end{lstlisting}
-\caption{The datatype for parse trees in Scala.\label{trees}}
+\caption{The datatype for abstract syntax trees in Scala.\label{trees}}
\end{figure}
\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 an AST. 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