equal
deleted
inserted
replaced
62 |
62 |
63 \section*{Coursework 3} |
63 \section*{Coursework 3} |
64 |
64 |
65 \noindent |
65 \noindent |
66 This coursework is worth 4\% and is due on 13 December at 16:00. You are asked to |
66 This coursework is worth 4\% and is due on 13 December at 16:00. You are asked to |
67 implement a compiler for the WHILE language. You are supposed to target the |
67 implement a compiler for the WHILE language which targets the |
68 assembler language provided by the Jasmin for running on the Java Virtual Machine. |
68 assembler language provided by the Jasmin. This assembler |
|
69 is available from |
|
70 |
|
71 \begin{center} |
|
72 \url{http://jasmin.sourceforge.net} |
|
73 \end{center} |
|
74 |
|
75 \noindent |
|
76 There is a user guide for Jasmin |
|
77 |
|
78 \begin{center} |
|
79 \url{http://jasmin.sourceforge.net/guide.html} |
|
80 \end{center} |
|
81 |
|
82 \noindent |
|
83 and also a description of some of the instructions that the JVM understands |
|
84 |
|
85 \begin{center} |
|
86 \url{http://jasmin.sourceforge.net/instructions.html} |
|
87 \end{center} |
|
88 |
|
89 \noindent |
69 |
90 |
70 |
91 |
71 \noindent |
92 \noindent |
72 You need to submit a document containing the answers for the questions |
93 You need to submit a document containing the answers for the questions |
73 below. You can do the implementation in any programming language you like, but you need |
94 below. You can do the implementation in any programming language you like, but you need |
76 in a txt-file or as pdf.\bigskip |
97 in a txt-file or as pdf.\bigskip |
77 |
98 |
78 |
99 |
79 \subsection*{Question 1 (marked with 1\%)} |
100 \subsection*{Question 1 (marked with 1\%)} |
80 |
101 |
|
102 You need to lex and parse WHILE programs and submit the assembler |
|
103 instructions for the Fibonacci program and for the program you submitted |
|
104 in Coursework 2 in Question 3. The latter should be so modified that |
|
105 a user can input the upper bound on the console (in the original question |
|
106 it was fixed to 100). |
81 |
107 |
|
108 \subsection*{Question 2 (marked with 2\%)} |
|
109 |
|
110 Extend the syntax of you language so that it contains also \texttt{for}-loops, like |
|
111 |
|
112 \begin{center} |
|
113 \texttt{for} \;\textit{Id} \texttt{:=} \textit{AExp}\; \texttt{upto} \;\textit{AExp}\; \texttt{do} \textit{Block} |
|
114 \end{center} |
82 |
115 |
83 \end{document} |
116 \end{document} |
84 |
117 |
85 %%% Local Variables: |
118 %%% Local Variables: |
86 %%% mode: latex |
119 %%% mode: latex |