equal
deleted
inserted
replaced
86 \begin{figure}[t] |
86 \begin{figure}[t] |
87 \lstinputlisting[language=while]{../progs/fib.while} |
87 \lstinputlisting[language=while]{../progs/fib.while} |
88 \caption{The Fibonacci program in the WHILE language.\label{fibs}} |
88 \caption{The Fibonacci program in the WHILE language.\label{fibs}} |
89 \end{figure} |
89 \end{figure} |
90 |
90 |
91 \subsection*{Question 2 (marked with 5\%)} |
91 \subsection*{Question 2 (marked with 4\%)} |
92 |
92 |
93 Extend the syntax of you language so that it contains also \texttt{for}-loops, like |
93 Extend the syntax of you language so that it contains also \texttt{for}-loops, like |
94 |
94 |
95 \begin{center} |
95 \begin{center} |
96 \texttt{for} \;\textit{Id} \texttt{:=} \textit{AExp}\; \texttt{upto} \;\textit{AExp}\; \texttt{do} \textit{Block} |
96 \texttt{for} \;\textit{Id} \texttt{:=} \textit{AExp}\; \texttt{upto} \;\textit{AExp}\; \texttt{do} \textit{Block} |
131 } |
131 } |
132 \end{lstlisting} |
132 \end{lstlisting} |
133 \end{minipage} |
133 \end{minipage} |
134 \end{center} |
134 \end{center} |
135 |
135 |
|
136 \subsection*{Question 3 (marked with 1\%)} |
|
137 |
136 \noindent |
138 \noindent |
137 In this question you are supposed to give the assembler instructions for the |
139 In this question you are supposed to give the assembler instructions for the |
138 program |
140 program |
139 |
141 |
140 \begin{center} |
142 \begin{center} |
141 \begin{minipage}{6cm} |
143 \begin{minipage}{6cm} |
142 \begin{lstlisting}[language=While,basicstyle=\ttfamily, numbers=none] |
144 \begin{lstlisting}[language=While,basicstyle=\ttfamily, numbers=none] |
143 for i := 1 upto 10000 do { |
145 for i := 1 upto 10 do { |
144 for i := 1 upto 10000 do { |
146 for i := 1 upto 10 do { |
145 skip |
147 write i |
146 } |
148 } |
147 } |
149 } |
148 \end{lstlisting} |
150 \end{lstlisting} |
149 \end{minipage} |
151 \end{minipage} |
150 \end{center} |
152 \end{center} |
151 |
153 |
152 \noindent |
154 \noindent |
153 Note that in this program the variable \pcode{i} is used |
155 Note that in this program the variable \pcode{i} is used |
154 twice. You need to make a decision how it should be compiled? |
156 twice. You need to make a decision how it should be compiled? |
|
157 Explain you decision and indicate what this program would |
|
158 print out. |
155 |
159 |
156 \subsection*{Further Information} |
160 \subsection*{Further Information} |
157 |
161 |
158 The Java infrastructure unfortunately does not contain an assembler out-of-the-box |
162 The Java infrastructure unfortunately does not contain an assembler out-of-the-box |
159 (therefore |
163 (therefore |