equal
deleted
inserted
replaced
7 %https://github.com/Storyyeller/Krakatau |
7 %https://github.com/Storyyeller/Krakatau |
8 %https://docs.oracle.com/javase/specs/jvms/se7/html/ |
8 %https://docs.oracle.com/javase/specs/jvms/se7/html/ |
9 |
9 |
10 \section*{Coursework 4 (Strand 1)} |
10 \section*{Coursework 4 (Strand 1)} |
11 |
11 |
12 \noindent This coursework is worth 10\% and is due on 11 |
12 \noindent This coursework is worth 5\% and is due on 13 |
13 December at 16:00. You are asked to implement a compiler for |
13 December at 16:00. You are asked to implement a compiler for |
14 the WHILE language that targets the assembler language |
14 the WHILE language that targets the assembler language |
15 provided by Jasmin or Krakatau (both have very similar |
15 provided by Jasmin or Krakatau (both have very similar |
16 syntax). You can do the implementation in any programming |
16 syntax). You can do the implementation in any programming |
17 language you like, but you need to submit the source code with |
17 language you like, but you need to submit the source code with |
122 %the submission will not be counted. However, the coursework |
122 %the submission will not be counted. However, the coursework |
123 %will \emph{only} be judged according to the answers. You can |
123 %will \emph{only} be judged according to the answers. You can |
124 %submit your answers in a txt-file or as pdf.\bigskip |
124 %submit your answers in a txt-file or as pdf.\bigskip |
125 |
125 |
126 |
126 |
127 \subsection*{Question 1 (marked with 5\%)} |
127 \subsection*{Question 1} |
128 |
128 |
129 You need to lex and parse WHILE programs, and then generate |
129 You need to lex and parse WHILE programs, and then generate |
130 Java Byte Code instructions for the Jasmin assembler (or |
130 Java Byte Code instructions for the Jasmin assembler (or |
131 Krakatau assembler). As solution you need to submit the |
131 Krakatau assembler). As solution you need to submit the |
132 assembler instructions for the Fibonacci and Factorial |
132 assembler instructions for the Fibonacci and Factorial |
139 \begin{figure}[t] |
139 \begin{figure}[t] |
140 \lstinputlisting[language=while]{../progs/fib.while} |
140 \lstinputlisting[language=while]{../progs/fib.while} |
141 \caption{The Fibonacci program in the WHILE language.\label{fibs}} |
141 \caption{The Fibonacci program in the WHILE language.\label{fibs}} |
142 \end{figure} |
142 \end{figure} |
143 |
143 |
144 \subsection*{Question 2 (marked with 4\%)} |
144 \subsection*{Question 2} |
145 |
145 |
146 Extend the syntax of your language so that it contains also |
146 Extend the syntax of your language so that it contains also |
147 \texttt{for}-loops, like |
147 \texttt{for}-loops, like |
148 |
148 |
149 \begin{center} |
149 \begin{center} |