updated
authorChristian Urban <christian dot urban at kcl dot ac dot uk>
Thu, 11 Dec 2014 21:13:48 +0000
changeset 321 c5850f8f3f5e
parent 320 0c43ef11e086
child 322 698ed1c96cd0
updated
coursework/cw04.pdf
coursework/cw04.tex
Binary file coursework/cw04.pdf has changed
--- a/coursework/cw04.tex	Wed Dec 10 13:58:06 2014 +0000
+++ b/coursework/cw04.tex	Thu Dec 11 21:13:48 2014 +0000
@@ -68,14 +68,13 @@
 
 \subsection*{Question 1 (marked with 5\%)}
 
-You need to lex and parse WHILE programs, and then generate
-Java Byte Code instructions for the Jasmin assmebler. As
-solution you need to submit the assembler instructions for the
-Fibonacci and Factorial programs. Both should be so modified
-that a user can input on the console which Fibonacci number 
-and which Factorial should calculated. The Fibonacci program
-is  given in Figure~\ref{fibs}. You can write your own program
-for calculating factorials.
+You need to lex and parse WHILE programs, and then generate Java Byte
+Code instructions for the Jasmin assembler. As solution you need to
+submit the assembler instructions for the Fibonacci and Factorial
+programs. Both should be so modified that a user can input on the
+console which Fibonacci number and which Factorial should
+calculated. The Fibonacci program is given in Figure~\ref{fibs}. You
+can write your own program for calculating factorials.
 
 \begin{figure}[t]
 \lstinputlisting[language=while]{../progs/fib.while}
@@ -287,11 +286,14 @@
 \end{center}
 
 \noindent 
-where \texttt{n} is the index of the variable that requires an input.
+where \texttt{n} is the index of the variable that requires an input. If you
+use Windows you need to take into account that a ``return'' is not just a newline,
+\code{'\\10'}, but \code{'\\13\\10'}. This means you need to change line~12 in 
+Figure~\ref{read} to \pcode{ldc 13}.  
 
 
-\begin{figure}[p]\small
-\begin{lstlisting}[language=JVMIS,numbers=none]
+\begin{figure}[t]\small
+\begin{lstlisting}[language=JVMIS]
 .method public static read()I 
       .limit locals 10 
       .limit stack 10
@@ -310,7 +312,6 @@
       ldc 32   ; the space delimiter 
       isub 
       ifeq Label2
-
       iload 2 
       ldc 48   ; we have our digit in ASCII, have to subtract it from 48 
       isub