# HG changeset patch # User Christian Urban # Date 1698327020 -3600 # Node ID 5070392a1bd77e994deb250db8ecda9e9faf6470 # Parent f5d2453c56406ae75d4768e1c78e8b003ea3a1d6 updated diff -r f5d2453c5640 -r 5070392a1bd7 progs/lexer/lexer.sc --- a/progs/lexer/lexer.sc Wed Oct 25 13:54:11 2023 +0100 +++ b/progs/lexer/lexer.sc Thu Oct 26 14:30:20 2023 +0100 @@ -59,9 +59,6 @@ -val r : Rexp = ("a" | "b").% -println(r) - def nullable(r: Rexp) : Boolean = r match { case ZERO => false case ONE => true @@ -84,8 +81,6 @@ case RECD(_, r1) => der(c, r1) } -println(der('a', ALT(STAR("a"), "b"))) - // extracts a string from a value def flatten(v: Val) : String = v match { case Empty => "" @@ -338,7 +333,8 @@ // // which has been removed in Scala 3. // -// for escaping strings in Scala 3 +// for escaping strings in Scala 3 use this equivalent code + import scala.quoted._ def escapeImpl(raw: Expr[String])(using Quotes): Expr[String] = { diff -r f5d2453c5640 -r 5070392a1bd7 slides/slides03.pdf Binary file slides/slides03.pdf has changed diff -r f5d2453c5640 -r 5070392a1bd7 slides/slides05.pdf Binary file slides/slides05.pdf has changed diff -r f5d2453c5640 -r 5070392a1bd7 slides/slides05.tex --- a/slides/slides05.tex Wed Oct 25 13:54:11 2023 +0100 +++ b/slides/slides05.tex Thu Oct 26 14:30:20 2023 +0100 @@ -80,7 +80,30 @@ % can stay unchanged. Use \texttt{ders} for CW2, not \texttt{ders2}! % \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - + +{ +\setbeamercolor{background canvas}{bg=cream} +\begin{frame}<1-10>[c] +\end{frame} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{frame}[c] + \frametitle{Coursework 1: Submissions} + + \begin{itemize} + \item Scala (162) + \item Ocaml (1) + \item Java (1) \ldots uses new features of Java 21 + \item Rust (6) + \end{itemize}\bigskip\bigskip + + +\end{frame} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +} + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame}[t] \frametitle{Parser} @@ -154,6 +177,36 @@ \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +{ +\setbeamercolor{background canvas}{bg=cream} +\begin{frame}[c] + +\begin{center} +\begin{tikzpicture}[scale=1.5,>=stealth',very thick, + every state/.style={minimum size=0pt, + draw=blue!50,very thick,fill=blue!20}] + \node[state,initial] (q0) at (0,2) {$q_0$}; + \node[state,accepting] (q1) at (2,2) {$q_1$}; + \node[state] (q2) at (0,0) {$q_2$}; + \node[state] (q3) at (2,0) {$q_3$}; + + \path[->] (q0) edge[bend left] node[above] {\alert{$a$}} (q1) + (q1) edge[bend left] node[above] {\alert{$a$}} (q0) + (q2) edge[bend left] node[above] {\alert{$a$}} (q3) + (q3) edge[bend left] node[above] {\alert{$a$}} (q2) + (q0) edge[bend left] node[right] {\alert{$b$}} (q2) + (q2) edge[bend left] node[left] {\alert{$b$}} (q0) + (q1) edge[bend left] node[right] {\alert{$b$}} (q3) + (q3) edge[bend left] node[left] {\alert{$b$}} (q1); +\end{tikzpicture} +\end{center} + +\hfill{}Which language? + +\end{frame} +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -638,6 +691,24 @@ \end{frame} +\begin{frame}[t] +\begin{minipage}{1.2\textwidth} + \begin{mybox3}{}\small + \textbf{Questions regarding CFL CW1} + +Dear Dr Urban + + Regarding CW1, I am stuck on finding the nullable and derivative rules for some important regexes.\smallskip + +The NOT Regex nullable rule: I am not sure how to approach this, I am inclined to simply put this as the negation of the nullable function on the input regex (e.g !nullable(r)). However I have found instances where negating a nullable does not make it un-nullable. For example the negation of r* can still match regex ab (which is not nullable). So I would like some actual clarification, pointers and help in this area.\smallskip + +The NOT Regex derivation rule: again I am dumbfounded here, I am inclined to think that I should derive the regex and then negate that derivation. But none of this ever works. Please provide some helpful information so I can solve this. +\end{mybox3} +\end{minipage} +\end{frame} + + + \end{document} %%% Local Variables: