equal
deleted
inserted
replaced
33 \subsection*{Question 2 (marked with 2\%)} |
33 \subsection*{Question 2 (marked with 2\%)} |
34 |
34 |
35 You should implement a parser for the WHILE language using |
35 You should implement a parser for the WHILE language using |
36 parser combinators. Be careful that the parser takes as input |
36 parser combinators. Be careful that the parser takes as input |
37 a stream, or list, of tokens generated by the tokenizer from |
37 a stream, or list, of tokens generated by the tokenizer from |
38 the previous coursework. Your parser should be able to handle |
38 the previous coursework. For this you might filter out |
|
39 whitespaces and comments. Your parser should be able to handle |
39 the WHILE programs in Figures~\ref{fib} and \ref{loop}. |
40 the WHILE programs in Figures~\ref{fib} and \ref{loop}. |
40 In addition give the parse tree for the statement: |
41 In addition give the parse tree for the statement: |
41 |
42 |
42 \begin{lstlisting}[language=While,numbers=none] |
43 \begin{lstlisting}[language=While,numbers=none] |
43 if (a < b) then skip else a := a * b + 1 |
44 if (a < b) then skip else a := a * b + 1 |