# HG changeset patch # User Christian Urban # Date 1671633185 0 # Node ID d8f870aad77d349a18e3e30410763de960e48bd2 # Parent 3faf015b7e24ef861da31df7cc6c5818761b91a3 updated diff -r 3faf015b7e24 -r d8f870aad77d cws/cw04.pdf Binary file cws/cw04.pdf has changed diff -r 3faf015b7e24 -r d8f870aad77d cws/cw04.tex --- a/cws/cw04.tex Fri Dec 09 13:18:10 2022 +0000 +++ b/cws/cw04.tex Wed Dec 21 14:33:05 2022 +0000 @@ -91,7 +91,7 @@ \noindent and \begin{center} - \small\url{http://www.csc.villanova.edu/~tway/courses/csc4181/s2021/labs/lab4/JVM.pdf} + \small\url{http://www.csc.villanova.edu/~tway/courses/csc4181/s2022/labs/finalproject/JVM.pdf} \end{center} \subsection*{Krakatau Assembler} @@ -204,7 +204,7 @@ i := 2; while (i <= 4) do { write i; - i := i + 1; + i := i + 1 } \end{lstlisting} \end{minipage} diff -r 3faf015b7e24 -r d8f870aad77d cws/cw05.pdf Binary file cws/cw05.pdf has changed diff -r 3faf015b7e24 -r d8f870aad77d cws/cw05.tex --- a/cws/cw05.tex Fri Dec 09 13:18:10 2022 +0000 +++ b/cws/cw05.tex Wed Dec 21 14:33:05 2022 +0000 @@ -65,11 +65,11 @@ on my end. You will be marked according to the input files \begin{itemize} -\item\href{https://talisker.nms.kcl.ac.uk/cgi-bin/repos.cgi/afl-material/raw-file/tip/cwtests/cw05/sqr.fun}{sqr.fun} -\item\href{https://talisker.nms.kcl.ac.uk/cgi-bin/repos.cgi/afl-material/raw-file/tip/cwtests/cw05/fact.fun}{fact.fun} -\item\href{https://talisker.nms.kcl.ac.uk/cgi-bin/repos.cgi/afl-material/raw-file/tip/cwtests/cw05/mand.fun}{mand.fun} -\item\href{https://talisker.nms.kcl.ac.uk/cgi-bin/repos.cgi/afl-material/raw-file/tip/cwtests/cw05/mand2.fun}{mand2.fun} -\item\href{https://talisker.nms.kcl.ac.uk/cgi-bin/repos.cgi/afl-material/raw-file/tip/cwtests/cw05/hanoi.fun}{hanoi.fun} +\item\href{https://nms.kcl.ac.uk/christian.urban/cfl/progs/sqr.fun}{sqr.fun} +\item\href{https://nms.kcl.ac.uk/christian.urban/cfl/progs/fact.fun}{fact.fun} +\item\href{https://nms.kcl.ac.uk/christian.urban/cfl/progs/mand.fun}{mand.fun} +\item\href{https://nms.kcl.ac.uk/christian.urban/cfl/progs/mand2.fun}{mand2.fun} +\item\href{https://nms.kcl.ac.uk/christian.urban/cfl/progs/hanoi.fun}{hanoi.fun} \end{itemize} \noindent diff -r 3faf015b7e24 -r d8f870aad77d handouts/ho01.pdf Binary file handouts/ho01.pdf has changed diff -r 3faf015b7e24 -r d8f870aad77d handouts/ho01.tex --- a/handouts/ho01.tex Fri Dec 09 13:18:10 2022 +0000 +++ b/handouts/ho01.tex Wed Dec 21 14:33:05 2022 +0000 @@ -46,8 +46,6 @@ \section*{Handout 1} -$\neq$ - The purpose of a compiler is to transform a program a human can read and write into code machines can run as fast as possible. Developing a compiler is an old craft going back to 1952 with the first compiler diff -r 3faf015b7e24 -r d8f870aad77d progs/fun/fun_llvm.sc --- a/progs/fun/fun_llvm.sc Fri Dec 09 13:18:10 2022 +0000 +++ b/progs/fun/fun_llvm.sc Wed Dec 21 14:33:05 2022 +0000 @@ -113,6 +113,14 @@ def CPSi(e: Exp) = CPS(e)(KReturn) //some testcases: +// (1 + 2) * 3 +println(CPSi(Aop("*", Aop("+", Num(1), Num(2)), Num(3))).toString) + +// 3 * (1 + 2) +println(CPSi(Aop("*", Num(3), Aop("+", Num(1), Num(2)))).toString) + +//some testcases: + // numbers and vars println(CPSi(Num(1)).toString) println(CPSi(Var("z")).toString)