Binary file coursework/cw03.pdf has changed
--- a/coursework/cw03.tex Sat Nov 23 11:16:35 2013 +0000
+++ b/coursework/cw03.tex Sat Nov 23 13:45:55 2013 +0000
@@ -64,7 +64,7 @@
\noindent
This coursework is worth 4\% and is due on 13 December at 16:00. You are asked to
-implement a compiler for the WHILE language which targets the
+implement a compiler for the WHILE language that targets the
assembler language provided by the Jasmin. This assembler
is available from
@@ -90,7 +90,7 @@
\noindent
-You need to submit a document containing the answers for the questions
+You need to submit a document containing the answers for the two questions
below. You can do the implementation in any programming language you like, but you need
to submit the source code with which you answered the questions. However, the coursework
will \emph{only} be judged according to the answers. You can submit your answers
@@ -151,6 +151,52 @@
\end{center}
+\subsection*{Further Information}
+
+The Java infrastructure unfortunately does not contain an assembler out-of-the-box
+(therefore
+you need to download the additional package Jasmin---see above). But it does contain a
+disassembler, called \texttt{javap}. A dissembler does the ``opposite'' of an assembler: it
+generates readable assembler code from Java Byte Code. Have a look at the
+following example. Compile using the usual Java compiler,
+\texttt{java}, the simple Hello World program below:
+
+\begin{center}
+\begin{minipage}{10cm}
+\begin{lstlisting}[language=Java,basicstyle=\ttfamily]
+class HelloWorld {
+ public static void main(String[] args) {
+ System.out.println("Hello World!");
+ }
+}
+\end{lstlisting}
+\end{minipage}
+\end{center}
+
+\noindent
+You can use the command
+
+\begin{center}
+\texttt{javap -v HelloWorld}
+\end{center}
+
+\noindent
+in order to see which Java Byte Code has been generated for this
+program. You can compare this with the code generated for the Scala
+version of Hello Worlds.
+
+\begin{center}
+\begin{minipage}{10cm}
+\begin{lstlisting}[language=Scala,basicstyle=\ttfamily]
+object HelloWorld {
+ def main(args: Array[String]) {
+ println("Hello World!")
+ }
+}
+\end{lstlisting}
+\end{minipage}
+\end{center}
+
\end{document}