diff -r da1f8c033b8e -r 94f5cce73a4f slides/slides01.tex --- a/slides/slides01.tex Thu Sep 19 19:25:13 2024 +0100 +++ b/slides/slides01.tex Sun Sep 29 18:46:02 2024 +0100 @@ -6,7 +6,7 @@ \usepackage{../data} \usetikzlibrary{cd} \usepackage{listings-rust} - +\usepackage{ulem} \usepackage{tcolorbox} \newtcolorbox{mybox}{colback=red!5!white,colframe=red!75!black} @@ -627,7 +627,7 @@ \footnotesize\textcolor{gray}{Grace Hopper}\smallskip\\ {\small\textcolor{gray}{(she made it to David Letterman's Tonight Show - \here{https://www.youtube.com/watch?v=oE2uls6iIEU})}} + \here{https://youtu.be/oE2uls6iIEU})}} \end{flushright} \end{textblock} @@ -635,25 +635,46 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +{\setbeamercolor{background canvas}{bg=cream} \begin{frame}[c] \frametitle{Some Housekeeping} \textbf{Exam will be computer-based, invigilated in some big examination hall:}\bigskip \begin{itemize} -\item final exam in January (35\%) -\item four CWs (65\% - first CW is optional) +\item final exam in January (\xout{35\%} \textbf{40\%}) +\item coursework (\xout{65\%} \textbf{60\%- very first part is now optional}) \end{itemize}\bigskip\bigskip\pause \textbf{Weekly Homework (optional):} \begin{itemize} \item uploaded on KEATS - solutions will be discussed during the SGTs -\item \alert{\bf all} questions in the exam will be from the HWs!! +\item \alert{\bf all} questions in the exam will be in some close shape or form from the HWs!! \end{itemize} +\end{frame}} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +{ +\setbeamercolor{background canvas}{bg=cream} +\begin{frame}[c] +\frametitle{Homework} + +Until 3 years ago: I did not give out solutions; students +sent emails to me and I responded to them individually.\bigskip\\ + +Now: We will review the homework mainly during the SGTs.\bigskip\\\pause + +I will still choose the questions from the HW for the exam, but there might be +some larger amount of deviation.\bigskip\pause + +Do not harass your TAs for the solutions! + \end{frame} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% {\definecolor{rred}{HTML}{C0504D} @@ -676,8 +697,8 @@ axis line style={-}, name=mygraph ] - -\addplot[ybar,style={rred,fill=rred!75,mark=none},text=black] coordinates { + +\only<1>{\addplot[ybar,style={rred,fill=rred!75,mark=none},text=black] coordinates { (2024,136) (2023,169) (2022,111) @@ -686,7 +707,17 @@ (2019,38) (2018,20) (2017,22) -(2016,8)}; +(2016,8)}}; +\only<2>{\addplot[ybar,style={rred,fill=rred!75,mark=none},text=black] coordinates { +(2024,173) +(2023,169) +(2022,111) +(2021,98) +(2020,59) +(2019,38) +(2018,20) +(2017,22) +(2016,8)}}; \end{axis} \node[anchor=north, yshift=-10mm] at (mygraph.south) {\small{}Student numbers since the start of the compiler module.}; @@ -697,34 +728,16 @@ \end{frame} } - - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% { \setbeamercolor{background canvas}{bg=cream} \begin{frame}[c] -\frametitle{Homework} - -Until 2 years ago: I did not give out solutions; students -sent emails to me and I responded to them individually.\bigskip\\ - - -Since last year: We will review the homework mainly during the SGTs.\bigskip\\\pause - -I will still choose the questions from the HW for the exam, but there might be -some larger amount of deviation. - -\end{frame} -} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\begin{frame}[c] \frametitle{Some Housekeeping} -\textbf{Coursework (5 accounting for 65\%):}\bigskip +\textbf{Coursework (4 parts accounting for 60\%; submission deadline \underline{2nd January}):}\bigskip \begin{itemize} -\item matcher (5\%) +\item matcher \xout{(5\%)}\;\;\textcolor{red}{optional from this year} \item lexer (10\%) \item parser / interpreter (10\%) \item JVM compiler (15\%) @@ -735,20 +748,61 @@ you can use any code I show you and is uploaded to KEATS\ldots\textbf{BUT NOTHING ELSE!} \end{frame} +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +{ +\setbeamercolor{background canvas}{bg=cream} +\begin{frame}[c,fragile] +\end{frame} +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +{ +\setbeamercolor{background canvas}{bg=cream} +\begin{frame}[c,fragile] +%%\frametitle{Scala 3} +I will show you all my code in Scala 3 + +\begin{minipage}{1.4\textwidth} +\begin{lstlisting}[language={},numbers=none,basicstyle=\ttfamily\small] +$ scala-cli +Welcome to Scala 3.5.0 (21.0.4, Java OpenJDK 64-Bit Server VM). +Type in expressions for evaluation. Or try :help. + +scala> 1 + 2 +res0: Int = 3 +\end{lstlisting} %% $ +\end{minipage}\medskip +\pause + +Since Scala 3.5.0, scala-cli is included in "plain" Scala + +\begin{minipage}{1.4\textwidth} +\begin{lstlisting}[language={},numbers=none,basicstyle=\ttfamily\small] +$ scala +Welcome to Scala 3.5.1 (21.0.4, Java OpenJDK 64-Bit Server VM). +Type in expressions for evaluation. Or try :help. + +scala> +\end{lstlisting} %% $ +\end{minipage} +\end{frame} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% { \setbeamercolor{background canvas}{bg=cream} \begin{frame}[c,fragile] \frametitle{Ammonite \& Scala 3} -I will show you all my code in Amm / Scala 3 +Actually in CFL, I will use Amm / Scala 3 \begin{minipage}{1.4\textwidth} \begin{lstlisting}[language={},numbers=none,basicstyle=\ttfamily\small] $ amm Loading... -Welcome to the Ammonite Repl 2.5.9 (Scala 3.2.2 Java 17.0.7) +Welcome to the Ammonite Repl 3.0.0-M2 (Scala 3.3.3 Java 21.0.4) scala> 1 + 2 res0: Int = 3 \end{lstlisting} %% $ @@ -777,7 +831,7 @@ \begin{itemize} \item Harry Dilnot (harry.dilnot@kcl.ac.uk) \\ \;\;Windows expert -\item Meilai Ji (meilai.ji@kcl.ac.uk) +\item Oliver Iliffe (oliver.iliffe@kcl.ac.uk) \end{itemize} \end{frame} @@ -1118,123 +1172,123 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -{ -\setbeamercolor{background canvas}{bg=cream} -\begin{frame}[c] -\frametitle{Rust vs.~Scala (from PEP)} +% { +% \setbeamercolor{background canvas}{bg=cream} +% \begin{frame}[c] +% \frametitle{Rust vs.~Scala (from PEP)} -\mbox{} +% \mbox{} -\begin{minipage}{1.3\textwidth} -\begin{mybox3}{}\it\small -\textbf{Re: Another question of purely academic interest about regex implementation in cw3} +% \begin{minipage}{1.3\textwidth} +% \begin{mybox3}{}\it\small +% \textbf{Re: Another question of purely academic interest about regex implementation in cw3} -This conversation is interesting to me, and I've researched it a -little bit [...] I also disagree with Dr.~Urban on the cost/benefit of -non-GC languages [...]\smallskip +% This conversation is interesting to me, and I've researched it a +% little bit [...] I also disagree with Dr.~Urban on the cost/benefit of +% non-GC languages [...]\smallskip -But regardless, Scala is a lot slower than, say, C or Rust. To say -it's not is basically wrong (imo). Perhaps one could argue that some -of the guarantees Scala has makes it easier to write multi-threaded -programs that utilise more of the CPU... but, in my opinion, this is -also a bit misleading. Most CPUs have something like 4 to 12 cores -nowadays. It's very possible that a given Scala program runs 4-12x -slower than its Rust equivalent. Would you rather have your program -run quickly and use a single core, or have it run equally -quickly... and... hog your entire CPU for its duration?\ldots{} +% But regardless, Scala is a lot slower than, say, C or Rust. To say +% it's not is basically wrong (imo). Perhaps one could argue that some +% of the guarantees Scala has makes it easier to write multi-threaded +% programs that utilise more of the CPU... but, in my opinion, this is +% also a bit misleading. Most CPUs have something like 4 to 12 cores +% nowadays. It's very possible that a given Scala program runs 4-12x +% slower than its Rust equivalent. Would you rather have your program +% run quickly and use a single core, or have it run equally +% quickly... and... hog your entire CPU for its duration?\ldots{} -\mbox{}\hfill-- Oliver Iliffe, discussion from PEP -\end{mybox3} -\end{minipage} +% \mbox{}\hfill-- Oliver Iliffe, discussion from PEP +% \end{mybox3} +% \end{minipage} -\end{frame} -} +% \end{frame} +% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -{ -\setbeamercolor{background canvas}{bg=cream} -\begin{frame}[c] -\frametitle{Regex Lib in Rust} +% { +% \setbeamercolor{background canvas}{bg=cream} +% \begin{frame}[c] +% \frametitle{Regex Lib in Rust} -\begin{center} -\includegraphics[scale=0.34]{../pics/rust-regex.png} -\end{center} +% \begin{center} +% \includegraphics[scale=0.34]{../pics/rust-regex.png} +% \end{center} -\end{frame} -} +% \end{frame} +% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -{ -\setbeamercolor{background canvas}{bg=cream} -\begin{frame}[c,fragile] +% { +% \setbeamercolor{background canvas}{bg=cream} +% \begin{frame}[c,fragile] -\begin{columns}[t,onlytextwidth] -\begin{column}{1\textwidth} -\small re: \bl{$(abc)^{\{n\}}$}\quad str: \bl{$\underbrace{abc\ldots{}abc}_n$}\medskip\\ -\begin{tikzpicture}\footnotesize -\begin{axis}[ - xlabel={$n$}, - x label style={at={(1.07,0.0)}}, - ylabel={time in secs}, - enlargelimits=false, - xmax=65000, - ymax=100, - xtick={0,15000,...,60000}, - ytick={0,10,...,90}, - scaled ticks=false, - axis lines=left, - width=7cm, - height=5cm] - \addplot[black,mark=square*,mark options={fill=red}] table [x=x, y=y, col sep=comma, row sep=crcr] - {x, y\\ - 0, 0\\ - 5000, 0.487\\ - 10000, 1.650\\ - 15000, 3.617\\ - 20000, 6.462\\ - 25000, 10.736\\ - 30000, 17.665\\ - 35000, 25.662\\ - 40000, 36.422\\ - 45000, 49.119\\ - 50000, 62.058\\ - 55000, 75.941\\ - 60000, 93.022\\ - }; -\end{axis} -\end{tikzpicture} -\end{column} -\end{columns} +% \begin{columns}[t,onlytextwidth] +% \begin{column}{1\textwidth} +% \small re: \bl{$(abc)^{\{n\}}$}\quad str: \bl{$\underbrace{abc\ldots{}abc}_n$}\medskip\\ +% \begin{tikzpicture}\footnotesize +% \begin{axis}[ +% xlabel={$n$}, +% x label style={at={(1.07,0.0)}}, +% ylabel={time in secs}, +% enlargelimits=false, +% xmax=65000, +% ymax=100, +% xtick={0,15000,...,60000}, +% ytick={0,10,...,90}, +% scaled ticks=false, +% axis lines=left, +% width=7cm, +% height=5cm] +% \addplot[black,mark=square*,mark options={fill=red}] table [x=x, y=y, col sep=comma, row sep=crcr] +% {x, y\\ +% 0, 0\\ +% 5000, 0.487\\ +% 10000, 1.650\\ +% 15000, 3.617\\ +% 20000, 6.462\\ +% 25000, 10.736\\ +% 30000, 17.665\\ +% 35000, 25.662\\ +% 40000, 36.422\\ +% 45000, 49.119\\ +% 50000, 62.058\\ +% 55000, 75.941\\ +% 60000, 93.022\\ +% }; +% \end{axis} +% \end{tikzpicture} +% \end{column} +% \end{columns} -\begin{textblock}{10}(8.4,3.8) -\tiny -\begin{lstlisting}[language=Rust] -extern crate regex; +% \begin{textblock}{10}(8.4,3.8) +% \tiny +% \begin{lstlisting}[language=Rust] +% extern crate regex; -use regex::Regex; -use std::time::Instant; +% use regex::Regex; +% use std::time::Instant; -// bounded regular expression example +% // bounded regular expression example -fn main() { - for bound in (0..=60000).step_by(5000) { +% fn main() { +% for bound in (0..=60000).step_by(5000) { - let re = Regex::new(&format!("(abc){{{}}}", bound)).unwrap(); - let text = "abc".repeat(bound); +% let re = Regex::new(&format!("(abc){{{}}}", bound)).unwrap(); +% let text = "abc".repeat(bound); - let start_time = Instant::now(); - let is_match = re.is_match(&text); - let elapsed_time = start_time.elapsed().as_secs_f64(); +% let start_time = Instant::now(); +% let is_match = re.is_match(&text); +% let elapsed_time = start_time.elapsed().as_secs_f64(); - println!("Bound: {}, Match: {}, Time: {} seconds", bound, is_match, elapsed_time); - } -} -\end{lstlisting} -\end{textblock} -\end{frame} -} +% println!("Bound: {}, Match: {}, Time: {} seconds", bound, is_match, elapsed_time); +% } +% } +% \end{lstlisting} +% \end{textblock} +% \end{frame} +% } @@ -1982,11 +2036,13 @@ \begin{tabular}{lll} - SGT TAs: & Flavio Melinte Citea & (was a KURF last summer)\\ - & Krishi Wali \\ - & Meilai Ji \medskip\\ + SGT TAs: & Flavio Melinte Citea & (was a KURF two summers ago)\\ + & Zishan Rahman\\ + & Harry Dilnot\\ + & Opale Sjostedt\medskip\\ Amm Helpers & Harry Dilnot & (harry.dilnot@kcl.ac.uk)\\ - & Meilai Ji & (meilai.ji@kcl.ac.uk)\medskip\\ + & Oliver Iliffe & (oliver.iliffe@kcl.ac.uk)\medskip\\ + & \multicolumn{2}{l}{\hspace{5mm}(was a KURF last summer)}\\ \end{tabular} \mbox{} \end{frame}