equal
deleted
inserted
replaced
39 |
39 |
40 \noindent |
40 \noindent |
41 on my end. You will be marked according to the input files |
41 on my end. You will be marked according to the input files |
42 |
42 |
43 \begin{itemize} |
43 \begin{itemize} |
44 \item\href{https://talisker.nms.kcl.ac.uk/cgi-bin/repos.cgi/afl-material/raw-file/tip/progs/fun2/sqr.fun}{sqr.fun} |
44 \item\href{https://talisker.nms.kcl.ac.uk/cgi-bin/repos.cgi/afl-material/raw-file/tip/cwtests/cw05/sqr.fun}{sqr.fun} |
45 \item\href{https://talisker.nms.kcl.ac.uk/cgi-bin/repos.cgi/afl-material/raw-file/tip/progs/fun2/fact.fun}{fact.fun} |
45 \item\href{https://talisker.nms.kcl.ac.uk/cgi-bin/repos.cgi/afl-material/raw-file/tip/cwtests/cw05/fact.fun}{fact.fun} |
46 \item\href{https://talisker.nms.kcl.ac.uk/cgi-bin/repos.cgi/afl-material/raw-file/tip/progs/fun2/mand.fun}{mand.fun} |
46 \item\href{https://talisker.nms.kcl.ac.uk/cgi-bin/repos.cgi/afl-material/raw-file/tip/cwtests/cw05/mand.fun}{mand.fun} |
47 \item\href{https://talisker.nms.kcl.ac.uk/cgi-bin/repos.cgi/afl-material/raw-file/tip/progs/fun2/mand2.fun}{mand2.fun} |
47 \item\href{https://talisker.nms.kcl.ac.uk/cgi-bin/repos.cgi/afl-material/raw-file/tip/cwtests/cw05/mand2.fun}{mand2.fun} |
48 \item\href{https://talisker.nms.kcl.ac.uk/cgi-bin/repos.cgi/afl-material/raw-file/tip/progs/fun2/hanoi.fun}{hanoi.fun} |
48 \item\href{https://talisker.nms.kcl.ac.uk/cgi-bin/repos.cgi/afl-material/raw-file/tip/cwtests/cw05/hanoi.fun}{hanoi.fun} |
49 \end{itemize} |
49 \end{itemize} |
50 |
50 |
51 \noindent |
51 \noindent |
52 which are uploaded to KEATS. |
52 which are uploaded to KEATS. |
53 |
53 |
113 case class Call(name: String, args: List[Exp]) extends Exp |
113 case class Call(name: String, args: List[Exp]) extends Exp |
114 case class If(a: BExp, e1: Exp, e2: Exp) extends Exp |
114 case class If(a: BExp, e1: Exp, e2: Exp) extends Exp |
115 case class Var(s: String) extends Exp |
115 case class Var(s: String) extends Exp |
116 case class Num(i: Int) extends Exp // integer numbers |
116 case class Num(i: Int) extends Exp // integer numbers |
117 case class FNum(i: Float) extends Exp // floating numbers |
117 case class FNum(i: Float) extends Exp // floating numbers |
118 case class ChConst(c: Int) extends Exp // char constant |
118 case class ChConst(c: Int) extends Exp // char constants |
119 case class Aop(o: String, a1: Exp, a2: Exp) extends Exp |
119 case class Aop(o: String, a1: Exp, a2: Exp) extends Exp |
120 case class Sequence(e1: Exp, e2: Exp) extends Exp |
120 case class Sequence(e1: Exp, e2: Exp) extends Exp |
121 case class Bop(o: String, a1: Exp, a2: Exp) extends BExp |
121 case class Bop(o: String, a1: Exp, a2: Exp) extends BExp |
122 \end{lstlisting} |
122 \end{lstlisting} |
123 |
123 |
130 part of the CW is to design the K-intermediate language and infer all |
130 part of the CW is to design the K-intermediate language and infer all |
131 necessary types in order to generate LLVM-IR code. You can check |
131 necessary types in order to generate LLVM-IR code. You can check |
132 your LLVM-IR code by running it with the interpreter \texttt{lli}. |
132 your LLVM-IR code by running it with the interpreter \texttt{lli}. |
133 |
133 |
134 \begin{figure}[t] |
134 \begin{figure}[t] |
135 \lstinputlisting[language=Scala]{../progs/fun2/mand.fun} |
135 \lstinputlisting[language=Scala]{../cwtests/cw05/mand.fun} |
136 \caption{The Mandelbrot program in the `typed' Fun-language.\label{mand}} |
136 \caption{The Mandelbrot program in the `typed' Fun-language.\label{mand}} |
137 \end{figure} |
137 \end{figure} |
138 |
138 |
139 \begin{figure}[t] |
139 \begin{figure}[t] |
140 \includegraphics[scale=0.35]{../progs/fun2/out.png} |
140 \includegraphics[scale=0.35]{../solution/cw5/out.png} |
141 \caption{Ascii output of the Mandelbrot program.\label{mand}} |
141 \caption{Ascii output of the Mandelbrot program.\label{mand}} |
142 \end{figure} |
142 \end{figure} |
143 |
143 |
144 Also note that the second version of the Mandelbrot program and also |
144 Also note that the second version of the Mandelbrot program and also |
145 the Tower of Hanoi program uses character constants, like \texttt{'a'}, |
145 the Tower of Hanoi program uses character constants, like \texttt{'a'}, |