625 \begin{flushright} |
625 \begin{flushright} |
626 \includegraphics[scale=0.3]{pics/hopper.jpg}\\ |
626 \includegraphics[scale=0.3]{pics/hopper.jpg}\\ |
627 \footnotesize\textcolor{gray}{Grace Hopper}\smallskip\\ |
627 \footnotesize\textcolor{gray}{Grace Hopper}\smallskip\\ |
628 |
628 |
629 {\small\textcolor{gray}{(she made it to David Letterman's Tonight Show |
629 {\small\textcolor{gray}{(she made it to David Letterman's Tonight Show |
630 \here{https://www.youtube.com/watch?v=oE2uls6iIEU})}} |
630 \here{https://youtu.be/oE2uls6iIEU})}} |
631 \end{flushright} |
631 \end{flushright} |
632 \end{textblock} |
632 \end{textblock} |
633 |
633 |
634 \end{frame} |
634 \end{frame} |
635 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
635 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
636 |
636 |
637 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
637 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
638 {\setbeamercolor{background canvas}{bg=cream} |
638 \begin{frame}[c] |
639 \begin{frame}[c] |
639 \frametitle{Some Housekeeping} |
640 \frametitle{Some Housekeeping} |
640 |
641 |
641 \textbf{Exam will be computer-based, invigilated in some big examination hall:}\bigskip |
642 \textbf{Exam will be computer-based, invigilated in some big examination hall:}\bigskip |
642 |
643 |
643 \begin{itemize} |
644 \begin{itemize} |
644 \item final exam in January (35\%) |
645 \item final exam in January (\xout{35\%} \textbf{40\%}) |
645 \item four CWs (65\% - first CW is optional) |
646 \item coursework (\xout{65\%} \textbf{60\%- very first part is now optional}) |
646 \end{itemize}\bigskip\bigskip\pause |
647 \end{itemize}\bigskip\bigskip\pause |
647 |
648 |
648 |
649 |
649 \textbf{Weekly Homework (optional):} |
650 \textbf{Weekly Homework (optional):} |
650 \begin{itemize} |
651 \begin{itemize} |
651 \item uploaded on KEATS - solutions will be discussed during the SGTs |
652 \item uploaded on KEATS - solutions will be discussed during the SGTs |
652 \item \alert{\bf all} questions in the exam will be from the HWs!! |
653 \item \alert{\bf all} questions in the exam will be in some close shape or form from the HWs!! |
653 \end{itemize} |
654 \end{itemize} |
654 |
655 |
655 \end{frame} |
656 \end{frame}} |
656 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
657 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
658 |
|
659 |
|
660 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
661 { |
|
662 \setbeamercolor{background canvas}{bg=cream} |
|
663 \begin{frame}[c] |
|
664 \frametitle{Homework} |
|
665 |
|
666 Until 3 years ago: I did not give out solutions; students |
|
667 sent emails to me and I responded to them individually.\bigskip\\ |
|
668 |
|
669 Now: We will review the homework mainly during the SGTs.\bigskip\\\pause |
|
670 |
|
671 I will still choose the questions from the HW for the exam, but there might be |
|
672 some larger amount of deviation.\bigskip\pause |
|
673 |
|
674 Do not harass your TAs for the solutions! |
|
675 |
|
676 \end{frame} |
|
677 } |
657 |
678 |
658 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
679 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
659 {\definecolor{rred}{HTML}{C0504D} |
680 {\definecolor{rred}{HTML}{C0504D} |
660 \setbeamercolor{background canvas}{bg=cream} |
681 \setbeamercolor{background canvas}{bg=cream} |
661 \begin{frame}[c] |
682 \begin{frame}[c] |
674 clip=false, |
695 clip=false, |
675 hide y axis, |
696 hide y axis, |
676 axis line style={-}, |
697 axis line style={-}, |
677 name=mygraph |
698 name=mygraph |
678 ] |
699 ] |
679 |
700 |
680 \addplot[ybar,style={rred,fill=rred!75,mark=none},text=black] coordinates { |
701 \only<1>{\addplot[ybar,style={rred,fill=rred!75,mark=none},text=black] coordinates { |
681 (2024,136) |
702 (2024,136) |
682 (2023,169) |
703 (2023,169) |
683 (2022,111) |
704 (2022,111) |
684 (2021,98) |
705 (2021,98) |
685 (2020,59) |
706 (2020,59) |
686 (2019,38) |
707 (2019,38) |
687 (2018,20) |
708 (2018,20) |
688 (2017,22) |
709 (2017,22) |
689 (2016,8)}; |
710 (2016,8)}}; |
|
711 \only<2>{\addplot[ybar,style={rred,fill=rred!75,mark=none},text=black] coordinates { |
|
712 (2024,173) |
|
713 (2023,169) |
|
714 (2022,111) |
|
715 (2021,98) |
|
716 (2020,59) |
|
717 (2019,38) |
|
718 (2018,20) |
|
719 (2017,22) |
|
720 (2016,8)}}; |
690 \end{axis} |
721 \end{axis} |
691 \node[anchor=north, yshift=-10mm] at (mygraph.south) {\small{}Student numbers since the start of the compiler module.}; |
722 \node[anchor=north, yshift=-10mm] at (mygraph.south) {\small{}Student numbers since the start of the compiler module.}; |
692 |
723 |
693 \end{tikzpicture} |
724 \end{tikzpicture} |
694 \end{center} |
725 \end{center} |
695 |
726 |
696 |
727 |
697 \end{frame} |
728 \end{frame} |
698 } |
729 } |
699 |
730 |
700 |
731 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
701 |
|
702 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
703 { |
732 { |
704 \setbeamercolor{background canvas}{bg=cream} |
733 \setbeamercolor{background canvas}{bg=cream} |
705 \begin{frame}[c] |
734 \begin{frame}[c] |
706 \frametitle{Homework} |
|
707 |
|
708 Until 2 years ago: I did not give out solutions; students |
|
709 sent emails to me and I responded to them individually.\bigskip\\ |
|
710 |
|
711 |
|
712 Since last year: We will review the homework mainly during the SGTs.\bigskip\\\pause |
|
713 |
|
714 I will still choose the questions from the HW for the exam, but there might be |
|
715 some larger amount of deviation. |
|
716 |
|
717 \end{frame} |
|
718 } |
|
719 |
|
720 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
721 \begin{frame}[c] |
|
722 \frametitle{Some Housekeeping} |
735 \frametitle{Some Housekeeping} |
723 |
736 |
724 \textbf{Coursework (5 accounting for 65\%):}\bigskip |
737 \textbf{Coursework (4 parts accounting for 60\%; submission deadline \underline{2nd January}):}\bigskip |
725 |
738 |
726 \begin{itemize} |
739 \begin{itemize} |
727 \item matcher (5\%) |
740 \item matcher \xout{(5\%)}\;\;\textcolor{red}{optional from this year} |
728 \item lexer (10\%) |
741 \item lexer (10\%) |
729 \item parser / interpreter (10\%) |
742 \item parser / interpreter (10\%) |
730 \item JVM compiler (15\%) |
743 \item JVM compiler (15\%) |
731 \item LLVM compiler (25\%) |
744 \item LLVM compiler (25\%) |
732 \end{itemize}\bigskip\pause |
745 \end{itemize}\bigskip\pause |
733 |
746 |
734 you can use \alert{any} programming language you like (Haskell, Rust, Swift)\\\pause |
747 you can use \alert{any} programming language you like (Haskell, Rust, Swift)\\\pause |
735 you can use any code I show you and is uploaded to KEATS\ldots\textbf{BUT NOTHING ELSE!} |
748 you can use any code I show you and is uploaded to KEATS\ldots\textbf{BUT NOTHING ELSE!} |
736 |
749 |
737 \end{frame} |
750 \end{frame} |
738 |
751 } |
|
752 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
753 { |
|
754 \setbeamercolor{background canvas}{bg=cream} |
|
755 \begin{frame}[c,fragile] |
|
756 \end{frame} |
|
757 } |
|
758 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
759 { |
|
760 \setbeamercolor{background canvas}{bg=cream} |
|
761 \begin{frame}[c,fragile] |
|
762 %%\frametitle{Scala 3} |
|
763 |
|
764 I will show you all my code in Scala 3 |
|
765 |
|
766 \begin{minipage}{1.4\textwidth} |
|
767 \begin{lstlisting}[language={},numbers=none,basicstyle=\ttfamily\small] |
|
768 $ scala-cli |
|
769 Welcome to Scala 3.5.0 (21.0.4, Java OpenJDK 64-Bit Server VM). |
|
770 Type in expressions for evaluation. Or try :help. |
|
771 |
|
772 scala> 1 + 2 |
|
773 res0: Int = 3 |
|
774 \end{lstlisting} %% $ |
|
775 \end{minipage}\medskip |
|
776 \pause |
|
777 |
|
778 Since Scala 3.5.0, scala-cli is included in "plain" Scala |
|
779 |
|
780 \begin{minipage}{1.4\textwidth} |
|
781 \begin{lstlisting}[language={},numbers=none,basicstyle=\ttfamily\small] |
|
782 $ scala |
|
783 Welcome to Scala 3.5.1 (21.0.4, Java OpenJDK 64-Bit Server VM). |
|
784 Type in expressions for evaluation. Or try :help. |
|
785 |
|
786 scala> |
|
787 \end{lstlisting} %% $ |
|
788 \end{minipage} |
|
789 \end{frame} |
|
790 } |
|
791 |
|
792 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
739 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
793 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
740 { |
794 { |
741 \setbeamercolor{background canvas}{bg=cream} |
795 \setbeamercolor{background canvas}{bg=cream} |
742 \begin{frame}[c,fragile] |
796 \begin{frame}[c,fragile] |
743 \frametitle{Ammonite \& Scala 3} |
797 \frametitle{Ammonite \& Scala 3} |
744 |
798 |
745 I will show you all my code in Amm / Scala 3 |
799 Actually in CFL, I will use Amm / Scala 3 |
746 |
800 |
747 \begin{minipage}{1.4\textwidth} |
801 \begin{minipage}{1.4\textwidth} |
748 \begin{lstlisting}[language={},numbers=none,basicstyle=\ttfamily\small] |
802 \begin{lstlisting}[language={},numbers=none,basicstyle=\ttfamily\small] |
749 $ amm |
803 $ amm |
750 Loading... |
804 Loading... |
751 Welcome to the Ammonite Repl 2.5.9 (Scala 3.2.2 Java 17.0.7) |
805 Welcome to the Ammonite Repl 3.0.0-M2 (Scala 3.3.3 Java 21.0.4) |
752 scala> 1 + 2 |
806 scala> 1 + 2 |
753 res0: Int = 3 |
807 res0: Int = 3 |
754 \end{lstlisting} %% $ |
808 \end{lstlisting} %% $ |
755 \end{minipage}\medskip |
809 \end{minipage}\medskip |
756 \pause |
810 \pause |
1116 |
1170 |
1117 \end{frame} |
1171 \end{frame} |
1118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
1172 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
1119 |
1173 |
1120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
1174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
1121 { |
1175 % { |
1122 \setbeamercolor{background canvas}{bg=cream} |
1176 % \setbeamercolor{background canvas}{bg=cream} |
1123 \begin{frame}[c] |
1177 % \begin{frame}[c] |
1124 \frametitle{Rust vs.~Scala (from PEP)} |
1178 % \frametitle{Rust vs.~Scala (from PEP)} |
1125 |
1179 |
1126 \mbox{} |
1180 % \mbox{} |
1127 |
1181 |
1128 \begin{minipage}{1.3\textwidth} |
1182 % \begin{minipage}{1.3\textwidth} |
1129 \begin{mybox3}{}\it\small |
1183 % \begin{mybox3}{}\it\small |
1130 \textbf{Re: Another question of purely academic interest about regex implementation in cw3} |
1184 % \textbf{Re: Another question of purely academic interest about regex implementation in cw3} |
1131 |
1185 |
1132 This conversation is interesting to me, and I've researched it a |
1186 % This conversation is interesting to me, and I've researched it a |
1133 little bit [...] I also disagree with Dr.~Urban on the cost/benefit of |
1187 % little bit [...] I also disagree with Dr.~Urban on the cost/benefit of |
1134 non-GC languages [...]\smallskip |
1188 % non-GC languages [...]\smallskip |
1135 |
1189 |
1136 But regardless, Scala is a lot slower than, say, C or Rust. To say |
1190 % But regardless, Scala is a lot slower than, say, C or Rust. To say |
1137 it's not is basically wrong (imo). Perhaps one could argue that some |
1191 % it's not is basically wrong (imo). Perhaps one could argue that some |
1138 of the guarantees Scala has makes it easier to write multi-threaded |
1192 % of the guarantees Scala has makes it easier to write multi-threaded |
1139 programs that utilise more of the CPU... but, in my opinion, this is |
1193 % programs that utilise more of the CPU... but, in my opinion, this is |
1140 also a bit misleading. Most CPUs have something like 4 to 12 cores |
1194 % also a bit misleading. Most CPUs have something like 4 to 12 cores |
1141 nowadays. It's very possible that a given Scala program runs 4-12x |
1195 % nowadays. It's very possible that a given Scala program runs 4-12x |
1142 slower than its Rust equivalent. Would you rather have your program |
1196 % slower than its Rust equivalent. Would you rather have your program |
1143 run quickly and use a single core, or have it run equally |
1197 % run quickly and use a single core, or have it run equally |
1144 quickly... and... hog your entire CPU for its duration?\ldots{} |
1198 % quickly... and... hog your entire CPU for its duration?\ldots{} |
1145 |
1199 |
1146 \mbox{}\hfill-- Oliver Iliffe, discussion from PEP |
1200 % \mbox{}\hfill-- Oliver Iliffe, discussion from PEP |
1147 \end{mybox3} |
1201 % \end{mybox3} |
1148 \end{minipage} |
1202 % \end{minipage} |
1149 |
1203 |
1150 \end{frame} |
1204 % \end{frame} |
1151 } |
1205 % } |
1152 |
1206 |
1153 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
1207 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
1154 { |
1208 % { |
1155 \setbeamercolor{background canvas}{bg=cream} |
1209 % \setbeamercolor{background canvas}{bg=cream} |
1156 \begin{frame}[c] |
1210 % \begin{frame}[c] |
1157 \frametitle{Regex Lib in Rust} |
1211 % \frametitle{Regex Lib in Rust} |
1158 |
1212 |
1159 \begin{center} |
1213 % \begin{center} |
1160 \includegraphics[scale=0.34]{../pics/rust-regex.png} |
1214 % \includegraphics[scale=0.34]{../pics/rust-regex.png} |
1161 \end{center} |
1215 % \end{center} |
1162 |
1216 |
1163 \end{frame} |
1217 % \end{frame} |
1164 } |
1218 % } |
1165 |
1219 |
1166 |
1220 |
1167 |
1221 |
1168 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
1222 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
1169 { |
1223 % { |
1170 \setbeamercolor{background canvas}{bg=cream} |
1224 % \setbeamercolor{background canvas}{bg=cream} |
1171 \begin{frame}[c,fragile] |
1225 % \begin{frame}[c,fragile] |
1172 |
1226 |
1173 \begin{columns}[t,onlytextwidth] |
1227 % \begin{columns}[t,onlytextwidth] |
1174 \begin{column}{1\textwidth} |
1228 % \begin{column}{1\textwidth} |
1175 \small re: \bl{$(abc)^{\{n\}}$}\quad str: \bl{$\underbrace{abc\ldots{}abc}_n$}\medskip\\ |
1229 % \small re: \bl{$(abc)^{\{n\}}$}\quad str: \bl{$\underbrace{abc\ldots{}abc}_n$}\medskip\\ |
1176 \begin{tikzpicture}\footnotesize |
1230 % \begin{tikzpicture}\footnotesize |
1177 \begin{axis}[ |
1231 % \begin{axis}[ |
1178 xlabel={$n$}, |
1232 % xlabel={$n$}, |
1179 x label style={at={(1.07,0.0)}}, |
1233 % x label style={at={(1.07,0.0)}}, |
1180 ylabel={time in secs}, |
1234 % ylabel={time in secs}, |
1181 enlargelimits=false, |
1235 % enlargelimits=false, |
1182 xmax=65000, |
1236 % xmax=65000, |
1183 ymax=100, |
1237 % ymax=100, |
1184 xtick={0,15000,...,60000}, |
1238 % xtick={0,15000,...,60000}, |
1185 ytick={0,10,...,90}, |
1239 % ytick={0,10,...,90}, |
1186 scaled ticks=false, |
1240 % scaled ticks=false, |
1187 axis lines=left, |
1241 % axis lines=left, |
1188 width=7cm, |
1242 % width=7cm, |
1189 height=5cm] |
1243 % height=5cm] |
1190 \addplot[black,mark=square*,mark options={fill=red}] table [x=x, y=y, col sep=comma, row sep=crcr] |
1244 % \addplot[black,mark=square*,mark options={fill=red}] table [x=x, y=y, col sep=comma, row sep=crcr] |
1191 {x, y\\ |
1245 % {x, y\\ |
1192 0, 0\\ |
1246 % 0, 0\\ |
1193 5000, 0.487\\ |
1247 % 5000, 0.487\\ |
1194 10000, 1.650\\ |
1248 % 10000, 1.650\\ |
1195 15000, 3.617\\ |
1249 % 15000, 3.617\\ |
1196 20000, 6.462\\ |
1250 % 20000, 6.462\\ |
1197 25000, 10.736\\ |
1251 % 25000, 10.736\\ |
1198 30000, 17.665\\ |
1252 % 30000, 17.665\\ |
1199 35000, 25.662\\ |
1253 % 35000, 25.662\\ |
1200 40000, 36.422\\ |
1254 % 40000, 36.422\\ |
1201 45000, 49.119\\ |
1255 % 45000, 49.119\\ |
1202 50000, 62.058\\ |
1256 % 50000, 62.058\\ |
1203 55000, 75.941\\ |
1257 % 55000, 75.941\\ |
1204 60000, 93.022\\ |
1258 % 60000, 93.022\\ |
1205 }; |
1259 % }; |
1206 \end{axis} |
1260 % \end{axis} |
1207 \end{tikzpicture} |
1261 % \end{tikzpicture} |
1208 \end{column} |
1262 % \end{column} |
1209 \end{columns} |
1263 % \end{columns} |
1210 |
1264 |
1211 \begin{textblock}{10}(8.4,3.8) |
1265 % \begin{textblock}{10}(8.4,3.8) |
1212 \tiny |
1266 % \tiny |
1213 \begin{lstlisting}[language=Rust] |
1267 % \begin{lstlisting}[language=Rust] |
1214 extern crate regex; |
1268 % extern crate regex; |
1215 |
1269 |
1216 use regex::Regex; |
1270 % use regex::Regex; |
1217 use std::time::Instant; |
1271 % use std::time::Instant; |
1218 |
1272 |
1219 // bounded regular expression example |
1273 % // bounded regular expression example |
1220 |
1274 |
1221 fn main() { |
1275 % fn main() { |
1222 for bound in (0..=60000).step_by(5000) { |
1276 % for bound in (0..=60000).step_by(5000) { |
1223 |
1277 |
1224 let re = Regex::new(&format!("(abc){{{}}}", bound)).unwrap(); |
1278 % let re = Regex::new(&format!("(abc){{{}}}", bound)).unwrap(); |
1225 let text = "abc".repeat(bound); |
1279 % let text = "abc".repeat(bound); |
1226 |
1280 |
1227 let start_time = Instant::now(); |
1281 % let start_time = Instant::now(); |
1228 let is_match = re.is_match(&text); |
1282 % let is_match = re.is_match(&text); |
1229 let elapsed_time = start_time.elapsed().as_secs_f64(); |
1283 % let elapsed_time = start_time.elapsed().as_secs_f64(); |
1230 |
1284 |
1231 println!("Bound: {}, Match: {}, Time: {} seconds", bound, is_match, elapsed_time); |
1285 % println!("Bound: {}, Match: {}, Time: {} seconds", bound, is_match, elapsed_time); |
1232 } |
1286 % } |
1233 } |
1287 % } |
1234 \end{lstlisting} |
1288 % \end{lstlisting} |
1235 \end{textblock} |
1289 % \end{textblock} |
1236 \end{frame} |
1290 % \end{frame} |
1237 } |
1291 % } |
1238 |
1292 |
1239 |
1293 |
1240 |
1294 |
1241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
1295 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
1242 %\begin{frame}[c] |
1296 %\begin{frame}[c] |