--- a/Spiral.scala Sun May 05 22:02:29 2019 +0100
+++ b/Spiral.scala Wed May 08 22:09:59 2019 +0100
@@ -445,19 +445,19 @@
val r = ("ab"| SEQ(ONE, "ab"))//internalise(random_struct_gen(4))//ASTAR(List(),AALTS(List(),List(ASTAR(List(Z),ACHAR(List(),'a')), ASEQ(List(S),ACHAR(List(),'a'),ACHAR(List(),'b')))))//internalise(balanced_struct_gen(3))//SEQ(ALTS(List(STAR("a"),ALTS(List("a","c")))),SEQ(ALTS(List("c","a")),ALTS(List("c","b")))) //random_struct_gen(7)
for(j <- 0 to s.length - 1){
val ss = s.slice(0, j+ 1)
- val nangao = ders_simp(r, ss.toList)
- val easy = bsimp(bders(ss.toList, r))
+ val nangao = ders_simp(internalise(r), ss.toList)
+ val easy = bsimp(bders(ss.toList, internalise(r)))
if(!(nangao == easy || pushbits(nangao) == (easy))){
println(j)
println("not equal")
println("string")
println(ss)
println("original regex")
- println(annotated_tree(r))
+ println(regx_tree(r))
println("regex after ders simp")
println(annotated_tree(nangao))
println("regex after ders")
- println(annotated_tree(bders(ss.toList, r)))//flats' fuse when opening up AALTS causes the difference
+ println(annotated_tree(bders(ss.toList, internalise(r))))//flats' fuse when opening up AALTS causes the difference
println("regex after ders and then a single simp")
println(annotated_tree(easy))
}
@@ -551,16 +551,24 @@
println(bs3)
}
def essence_posix(){
- val s = "abab"//rd_string_gen(alphabet_size, 3)//"abaa"//rd_string_gen(alphabet_size, 3)
- val r = STAR("ab"| SEQ(ONE, "ab"))//internalise(random_struct_gen(4))//ASTAR(List(),AALTS(List(),List(ASTAR(List(Z),ACHAR(List(),'a')), ASEQ(List(S),ACHAR(List(),'a'),ACHAR(List(),'b')))))//internalise(balanced_struct_gen(3))//SEQ(ALTS(List(STAR("a"),ALTS(List("a","c")))),SEQ(ALTS(List("c","a")),ALTS(List("c","b")))) //random_struct_gen(7)
- ders(s.toList, r)
+ //val s = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"//rd_string_gen(alphabet_size, 3)//"abaa"//rd_string_gen(alphabet_size, 3)
+ val s0 = "a"
+ val r = SEQ(STAR(ALT("a", "aa")), "b")//internalise(random_struct_gen(4))//ASTAR(List(),AALTS(List(),List(ASTAR(List(Z),ACHAR(List(),'a')), ASEQ(List(S),ACHAR(List(),'a'),ACHAR(List(),'b')))))//internalise(balanced_struct_gen(3))//SEQ(ALTS(List(STAR("a"),ALTS(List("a","c")))),SEQ(ALTS(List("c","a")),ALTS(List("c","b")))) //random_struct_gen(7)
+ for(i <- 1 to 40){
+ val s = s0*i
+ //printf("%d %d\n",i, size(ders(s.toList, r)))
+ printf("%d %d\n",i, asize(ders_simp( internalise(r), s.toList)))
+ //println(asize(ders_simp( internalise(r), s.toList)))
+ }
}
+
def main(args: Array[String]) {
//check_all()
//radical_correctness()
//correctness_proof_convenient_path()
//retrieve_experience()
- christian_def()
+ //christian_def()
+ essence_posix()
}
}
--- a/lex_blex_Frankensteined.scala Sun May 05 22:02:29 2019 +0100
+++ b/lex_blex_Frankensteined.scala Wed May 08 22:09:59 2019 +0100
@@ -415,7 +415,7 @@
def flats_vsimp(rs: List[ARexp], position: Int): Int = (rs, position) match {
case (_, 0) => 0
case (Nil, _) => 0
- case (ZERO :: rs1, _) => flats_vsimp(rs1, position - 1) - 1
+ case (AZERO :: rs1, _) => flats_vsimp(rs1, position - 1) - 1
case (AALTS(bs, rs1) :: rs2, _) => rs1.length - 1 + flats_vsimp(rs2, position - 1)
case (r1 :: rs2, _) => flats_vsimp(rs2, position - 1)
}
@@ -448,29 +448,29 @@
//case ASTAR(bs, r) => ASTAR(bs, bsimp(r))
case r => r
}
- def find_pos(v: Val, rs: List[Rexp]): Int = (rs, v) match{
+ def find_pos(v: Val, rs: List[Rexp]): Int = (v, rs) match{
case (Right(v), r::Nil) => 1
case (Left(v), r::rs) => 0
case (Right(v), r::rs) => find_pos(v, rs) + 1
case (v, _) => 0
}
- def remove(v: Val, rs: List[Rexp]) : Val = (rs,v) match {//remove the outmost layer of ALTS's Left and Right
+ def remove(v: Val, rs: List[Rexp]) : Val = (v,rs) match {//remove the outmost layer of ALTS's Left and Right
case (Right(v), r::Nil) => v
case (Left(v), r::rs) => v
case (Right(v), r::rs) => remove(v, rs)
}
- def simple_end(v: Value): Boolean = v match {
+ def simple_end(v: Val): Boolean = v match {
case Left(v) => return false
case Right(v) => return simple_end(v)
case v => return true
}
- def isend(v: Val, rs: List[Rexp], position: Int): Boolean = {
+ def isend(v: Val, rs: List[ARexp], position: Int): Boolean = {
val rsbh = rs.slice(position, rs.length)
val out_end = if(flats(rsbh) == Nil) true else false
val inner_end = simple_end(v)
inner_end && out_end
}
- def get_coat(v: Val, rs: List[Rexp], vs: Val): Val = (rs, v) match{//the dual operation of remove(so-called by myself)
+ def get_coat(v: Val, rs: List[Rexp], vs: Val): Val = (v, rs) match{//the dual operation of remove(so-called by myself)
case (Right(v), r::Nil) => Right(vs)
case (Left(v), r::rs) => Left(vs)
case (Right(v), r::rs) => Right(get_coat(v, rs, vs))
@@ -479,6 +479,7 @@
case 0 => v
case i => coat(Right(v), i - 1)
}
+ /*
def bsimp2(r: ARexp, v: Val): (ARexp, Val => Val) = (r,v) match{
case (ASEQ(bs1, r1, r2), v) => (bsimp2(r1), bsimp2(r2)) match {
case ((AZERO, _), (_, _) )=> (AZERO, undefined)
@@ -510,7 +511,7 @@
}
//case ASTAR(bs, r) => ASTAR(bs, bsimp(r))
case r => r
- }
+ }*/
def super_bsimp(r: ARexp): ARexp = r match {
case ASEQ(bs1, r1, r2) => (super_bsimp(r1), super_bsimp(r2)) match {
case (AZERO, _) => AZERO
--- a/slides01.tex Sun May 05 22:02:29 2019 +0100
+++ b/slides01.tex Wed May 08 22:09:59 2019 +0100
@@ -3,7 +3,7 @@
\usepackage{./graph}
\usepackage{./langs}
\usepackage{./data}
-
+\usepackage{changepage}
\hfuzz=220pt
\lstset{language=Scala,
@@ -82,7 +82,78 @@
60000 43.0327746
\end{filecontents}
+\begin{filecontents}{re-usize.data}
+1 16
+2 33
+3 63
+4 108
+5 181
+6 297
+7 484
+8 785
+9 1271
+10 2056
+11 3325
+12 5377
+13 8696
+14 14065
+15 22751
+16 36804
+17 59541
+18 96329
+19 155852
+20 252161
+21 407991
+22 660128
+23 1068093
+24 1728193
+25 2796256
+26 4524417
+27 7320639
+\end{filecontents}
+\begin{filecontents}{re-ssize.data}
+1 12
+2 19
+3 19
+4 19
+5 19
+6 19
+7 19
+8 19
+9 19
+10 19
+11 19
+12 19
+13 19
+14 19
+15 19
+16 19
+17 19
+18 19
+19 19
+20 19
+21 19
+22 19
+23 19
+24 19
+25 19
+26 19
+27 19
+28 19
+29 19
+30 19
+31 19
+32 19
+33 19
+34 19
+35 19
+36 19
+37 19
+38 19
+39 19
+40 19
+\end{filecontents}
\begin{document}
@@ -96,9 +167,9 @@
\begin{frame}[t]
\frametitle{%
\begin{tabular}{@ {}c@ {}}
- \\[-3mm]
- \LARGE Compilers and \\[-1mm]
- \LARGE Formal Languages (1)\\[-3mm]
+ \\[-1mm]
+ \LARGE Fast Regular Expression \\[-1mm]
+ \LARGE Matching Using Derivatives\\[-3mm]
\end{tabular}}
\begin{center}
@@ -110,18 +181,46 @@
\normalsize
\begin{center}
\begin{tabular}{ll}
- Email: & christian.urban at kcl.ac.uk\\
- Office: & N\liningnums{7.07} (North Wing, Bush House)\\
- Slides: & KEATS
+ %Email: & christian.urban at kcl.ac.uk\\
+ %Office: & N\liningnums{7.07} (North Wing, Bush House)\\
+ %Slides: & KEATS
+ Student: & Chengsong Tan\\
+ Supervisor: & Christian Urban \\
+ Date: & 2019/5/10
\end{tabular}
\end{center}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t]
-\frametitle{Why Study Compilers?}
+\frametitle{Regular Expressions}
+
+Their inductive definition:\\
+\hspace{10pt}
+\vspace{100pt}
+
+\begin{textblock}{6}(1.5,3.5)
+ \begin{tabular}{@ {}rrl@ {\hspace{13mm}}l}
+ \bl{$r$} & \bl{$::=$} & \bl{$\ZERO$} & nothing\\
+ & \bl{$\mid$} & \bl{$\ONE$} & empty string / \pcode{""} / $[]$\\
+ & \bl{$\mid$} & \bl{$c$} & character\\
+ & \bl{$\mid$} & \bl{$r_1 + r_2$} & alternative / choice\\
+ & \bl{$\mid$} & \bl{$r_1 \cdot r_2$} & sequence\\
+ & \bl{$\mid$} & \bl{$r^*$} & star (zero or more)\\
+ \end{tabular}
+ \end{textblock}
+
+ \begin{itemize}
+\item { Formalized by Stephen Coles Kleene in 1950s}
+\item {\bf What could be possibly interesting?}
+ \end{itemize}
+\end{frame}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\iffalse
+\begin{frame}[t]
+\frametitle{Regular Expressions}
John Regehr {\small(Univ.~Utah, LLVM compiler hacker)}\smallskip\\
@@ -162,9 +261,11 @@
\end{itemize}}}
\end{frame}
+\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\iffalse
\begin{frame}[c]
\frametitle{Why Bother?}
@@ -257,15 +358,24 @@
matching \texttt{[a?]\{n\}[a]\{n\}} and \texttt{(a*)*b}
against $\underbrace{\texttt{a}...\texttt{a}}_n$
\end{frame}
+\fi
-\begin{frame}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\begin{frame}[c]
+\frametitle{Catastrophic Backtracking}
+
+\begin{columns}
\begin{column}{.5\textwidth}
+
\begin{tikzpicture}
\begin{axis}[
xlabel={$n$},
- x label style={at={(1.05,0.0)}},
+ x label style={at={(1.07,0.0)}},
ylabel={time in secs},
- y label style={at={(0.06,0.5)}},
+ %y label style={at={(0.06,0.5)}},
enlargelimits=false,
xtick={0,5,...,30},
xmax=33,
@@ -273,20 +383,21 @@
ytick={0,10,...,40},
scaled ticks=false,
axis lines=left,
- width=6cm,
- height=4.5cm,
+ width=5cm,
+ height=4cm,
legend entries={Python, Java 8},
legend pos=north west]
\addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data};
\addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data};
\end{axis}
\end{tikzpicture}
+
\begin{tikzpicture}
\begin{axis}[
xlabel={$n$},
- x label style={at={(1.05,0.0)}},
+ x label style={at={(1.07,0.0)}},
ylabel={time in secs},
- y label style={at={(0.06,0.5)}},
+ %y label style={at={(0.06,0.5)}},
%enlargelimits=false,
%xtick={0,5000,...,30000},
xmax=65000,
@@ -294,23 +405,58 @@
ytick={0,10,...,40},
scaled ticks=false,
axis lines=left,
- width=6cm,
- height=4.5cm,
+ width=5cm,
+ height=4cm,
legend entries={Java 9},
legend pos=north west]
\addplot[cyan,mark=*, mark options={fill=white}] table {re-java9.data};
\end{axis}
\end{tikzpicture}
\end{column}
+\end{columns}\bigskip
+\center
+matching \texttt{(a*)*b}
+against $\underbrace{\texttt{a}...\texttt{a}}_n$
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{frame}[fragile]
+\frametitle{Impact}
+
+\begin{itemize}
+\item Network Traffic Analysis
+\begin{itemize}
+\item Snort: > 5 million downloads
+\item Bro: > 10000 downloads
+\item thousands of regexes
+\item \alert{R}egular \alert{e}xpression \alert{D}enial \alert{o}f \alert{S}ervice (ReDoS)\medskip
+
+\end{itemize}
+
+\begin{verbatim}
+ Jan 2 00:53:19 talisker sshd: Received disconnect from 110.53.183.227: [preauth]
+ Jan 2 00:58:31 talisker sshd: Received disconnect from 110.53.183.252: [preauth]
+ Jan 2 01:01:28 talisker sshd: Received disconnect from 221.194.47.236: [preauth]
+ Jan 2 01:03:59 talisker sshd: Received disconnect from 110.53.183.228: [preauth]
+ Jan 2 01:06:53 talisker sshd: Received disconnect from 221.194.47.245: [preauth]
+ ...
+\end{verbatim}
+
+
+\item Compilers: lexical analysis
+\end{itemize}
+
+\end{frame}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c]
\frametitle{Evil Regular Expressions}
\begin{itemize}
-\item \alert{R}egular \alert{e}xpression \alert{D}enial \alert{o}f \alert{S}ervice (ReDoS)\medskip
+%\item \alert{R}egular \alert{e}xpression \alert{D}enial \alert{o}f \alert{S}ervice (ReDoS)\medskip
\item Evil regular expressions\medskip
\begin{itemize}
\item \bl{$(a^{?\{n\}}) \cdot a^{\{n\}}$}
@@ -318,584 +464,296 @@
\item \bl{$([a$\,-\,$z]^+)^*$}
\item \bl{$(a + a \cdot a)^*$}
\item \bl{$(a + a^?)^*$}
+\item \bl{$\^(.*?,)\{11\}P$}
+\item \bl{$<html>.*?<head>.*?<title>.*?</title>.*?</head>.*?<body[^>]*>.*?</body>.*?</html>$}
+\end{itemize}
+
+\item Pearl Compatible Regular Expression(PCRE) \bl{$(r) \backslash 1$}
\end{itemize}
-\item sometimes also called \alert{catastrophic backtracking}
-\item this is a problem for \alert{N}etwork \alert{I}ntrusion
- \alert{D}etection systems, StackExchange, Atom editor
-\item \url{https://vimeo.com/112065252}
+\end{frame}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\begin{frame}[c]
+\frametitle{A Concrete Example}
+\begin{adjustwidth*}{}{-1.2cm}
+\resizebox{13cm}{4cm}{
+
+ \begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid,auto]
+ \node[state,initial] (q_0) {$0$};
+ \node[state] (q_1) [right = of q_0] {$1$};
+ \node[state] (q_2) [right=of q_1] {$2$};
+ \node (q_dots1) [right = of q_2] {$\cdots$};
+ \node [state] (q_n) [right = of q_dots1] {$n$};
+ \node [state] (q_n1) [right = of q_n] {$n+1$};
+ \node[state] (q_n2) [right=of q_n1] {$n+2$};
+ \node[state,accepting] (q_n3) [right=of q_n2] {$n+3$};
+
+ \path[->]
+ (q_0) edge [loop above] node {$*$} (q_0)
+ (q_0) edge node {$a$} (q_1)
+ (q_1) edge node {$*$} (q_2)
+ (q_2) edge node {$*$} (q_dots1)
+ (q_dots1) edge node{$*$} (q_n)
+ (q_n) edge node{$*$} (q_n1)
+ (q_n1) edge node{$*$} (q_n2)
+ (q_n2) edge node{$*$} (q_n3);
+
+\draw [decorate,decoration={brace,amplitude=10pt,mirror,raise=10pt},yshift=0pt]
+(q_2.south west) -- (q_n1.south east) node [black,midway,yshift = -2cm] {\footnotesize n states};
+%\draw [decorate,decoration={brace,amplitude=10pt,mirror,raise=4pt},yshift=0pt]
+%(3.5,0.65) -- (3.5,6.5) node [black,midway,xshift=0.8cm] {\footnotesize
+%$P_2$};
+\end{tikzpicture}
+}
+\end{adjustwidth*}
+
+\begin{itemize}
+\item
+NFA accepting Regex $.*a.{n}bc$
+\item
+Matching the string aaaaaaaaaaaaaaa.....abc
+\end{itemize}
+\end{frame}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{frame}[c]
+\frametitle{Brzozowski Derivative}
+
+\begin{itemize}
+\item Brzozowski invented in his 1964 Phd thesis
+\item Intuition: Chopping off the first character
+
+\begin{center}
+\bl{$A \backslash c \dn \{ s \;|\; c\!::\!s \in A\}$ }
+\end{center}
+\item
+For \bl{$A = \{\textit{foo}, \textit{bar}, \textit{frak}\}$} then
+
+\begin{center}
+\bl{\begin{tabular}{l@{\hspace{2mm}}c@{\hspace{2mm}}l}
+$A \backslash f $ & $=$ & $\{\textit{oo}, \textit{rak}\}$\\
+$A \backslash b $ & $=$ & $\{\textit{ar}\}$\\
+$A \backslash a $ & $=$ & $\{\}$\pause
+\end{tabular}}
+\end{center}
+\item
+\begin{tabular}{rp{4cm}}
+\bl {$r \,matches \,s=c_1c_2...c_n$}
+\bl{$\Leftrightarrow$} \bl{$c_1c_2...c_n \in L(r)$} \bl{$\Leftrightarrow$}\\
+ \bl{$c_2...c_n \in L(r) \backslash c_1$}\\
+\bl{$\Leftrightarrow$} \bl{$\cdots$}\\
+\bl{$\Leftrightarrow$} \bl{$[] \in ((L(r)\backslash c_1) \backslash c_2)\cdots\backslash c_n$}
+\end{tabular}
+
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\begin{frame}[c]
+\frametitle{Previous Example}
+
+\begin{center}
+\begin{tikzpicture}
+ \begin{axis}[
+ xlabel={$n$},
+ x label style={at={(1.09,-0.15)}},
+ ylabel={time in secs},
+ scaled x ticks=false,
+ enlargelimits=false,
+ xtick distance=10000,
+ xmax=44000,
+ ytick={0,10,...,30},
+ ymax=35,
+ axis lines=left,
+ width=7cm,
+ height=3.5cm,
+ legend entries={Java \liningnums{9}+},
+ legend pos=north west,
+ legend cell align=left]
+\addplot[blue,mark=square*,mark options={fill=white}] table {re-java9.data};
+\end{axis}
+\end{tikzpicture}
+\end{center}
+
+\begin{center}
+\begin{tikzpicture}
+ \begin{axis}[
+ xlabel={$n$},
+ x label style={at={(1.09,0.0)}},
+ ylabel={time in secs},
+ scaled x ticks=false,
+ xtick distance=2000000,
+ enlargelimits=false,
+ xmax=6400000,
+ ytick={0,10,...,30},
+ ymax=35,
+ axis lines=left,
+ width=7cm,
+ height=3.5cm,
+ legend entries={Simple Scala},
+ legend pos=north west,
+ legend cell align=left]
+%\addplot[green,mark=square*,mark options={fill=white}] table {re2a.data};
+\addplot[black,mark=square*,mark options={fill=white}] table {re3a.data};
+\end{axis}
+\end{tikzpicture}
+\end{center}
+
+Regex: \bl{$(a^*)^* \cdot b$} \space\space\space\space\space\space
+Strings of the form \bl{$\underbrace{\,a\ldots a\,}_{n}$}
+
+\end{frame}
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[c]
-\frametitle{The Goal of this Module}
+\begin{frame}[t]
+\frametitle{Optimization}
\begin{center}
- \begin{tikzpicture}[scale=1,
- node/.style={
- rectangle,rounded corners=3mm,
- very thick,draw=black!50,minimum height=18mm, minimum width=20mm,
- top color=white,bottom color=black!20}]
-
- \node at (3.05, 1.8) {\Large\bf write a compiler};
-
- \node (0) at (-2.3,0) {};
- \node [above=5mm of 0]
- {\makebox[0mm]{\footnotesize
- \begin{tabular}{@{}l@{}}input\\[-1mm]program\end{tabular}}};
-
- \node (A) at (0,0) [node] {};
- \node [below right] at (A.north west) {lexer};
-
- \node (B) at (3,0) [node] {};
- \node [below right=1mm] at (B.north west) {\mbox{}\hspace{-1mm}parser};
-
- \node (C) at (6,0) [node] {};
- \node [below right] at (C.north west) {\mbox{}\hspace{-1mm}code gen};
-
- \node (1) at (8.4,0) {};
- \node [above=5mm of 1]
- {\makebox[0mm]{\footnotesize
- \begin{tabular}{@{}r@{}}binary\\[-1mm]code\end{tabular}}};
-
- \draw [->,line width=4mm] (0) -- (A);
- \draw [->,line width=4mm] (A) -- (B);
- \draw [->,line width=4mm] (B) -- (C);
- \draw [->,line width=4mm] (C) -- (1);
- \end{tikzpicture}
- \end{center}
-
-\only<2,3,4>{
-\begin{textblock}{1}(1,2.1)
-\begin{bubble}[9.8cm]
-\normalsize
-lexer input: a string\smallskip\\
-\hspace{5mm}\code{"read(n);"}\medskip\\
-lexer output: a sequence of tokens\smallskip\\
-\hspace{5mm}\code{key(read) lpar id(n) rpar semi}
-\end{bubble}
-\end{textblock}}
-
-\only<3,4>{
-\begin{textblock}{1}(6,7.8)
-\begin{tabular}{c}
-\includegraphics[scale=0.2]{rosetta.jpg}\\[-2mm]
-\footnotesize lexing $\Rightarrow$ recognising words (Stone of Rosetta)
-\end{tabular}
-\end{textblock}}
-
-\only<4>{
-\begin{textblock}{1}(0.5,12)\small
-\begin{tabular}{l@{}c@{}l}
- \pcode{if} & $\;\Rightarrow\;$ & keyword\\
- \pcode{iffoo} & $\;\Rightarrow\;$ & identifier\\
-\end{tabular}
-\end{textblock}}
+\begin{tikzpicture}
+\begin{semilogyaxis}[
+ xlabel={$n$},
+ x label style={at={(1.05,0.0)}},
+ ylabel={regex size},
+ enlargelimits=false,
+ xtick={1,4,...,30},
+ xmax=33,
+ %ytick={0, 10,...,100},
+ scaled ticks=false,
+ axis lines=left,
+ width=9cm,
+ height=4.5cm,
+ legend entries={Simple Scala},
+ legend pos= south east,
+ legend cell align=left
+]
+\addplot[black,mark=square*, mark options={fill=white}] table {re-usize.data};
+%\addplot[brown,mark=pentagon*, mark options={fill=white}] table {re-ssize.data};
+%\addplot[red,mark=triangle*,mark options={fill=white}] table {re1.data};
+%\addplot[green,mark=square*,mark options={fill=white}] table {re2.data};
+\end{semilogyaxis}
+\end{tikzpicture}
+\end{center}
+Regex: \bl{$(a+aa)^* \cdot b$} \space\space\space\space\space\space
+Strings of the form \bl{$\underbrace{\,a\ldots a\,}_{n}$}\\
+\begin{itemize}
+\item
+Solution: Simplification%(Sulzmann \& Lu)
+\begin{itemize}
+\item $r+(r+s) = r+r+s = r+s$
+\item $1 \cdot r= r$
+\end{itemize}
+\end{itemize}
+\end{frame}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{frame}[t]
+\frametitle{Optimization}
-\only<5>{
-\begin{textblock}{1}(1,1.5)
-\begin{bubble}[8.5cm]
-\normalsize
-parser input: a sequence of tokens\smallskip\\
-
-{\small\hspace{5mm}\code{key(read) lpar id(n) rpar semi}}\smallskip\\
-
-parser output: an abstract syntax tree\smallskip\\
-\footnotesize
-\hspace{2cm}\begin{tikzpicture}
- \node {\code{read}}
- child {node {\code{lpar}}}
- child {node {\code{n}}}
- child {node {\code{rpar}}};
-\end{tikzpicture}
-\end{bubble}
-\end{textblock}}
+Regex: \bl{$(a+aa)^* \cdot b$} \space\space\space\space\space\space
+Strings of the form \bl{$\underbrace{\,a\ldots a\,}_{n}$}
-\only<6,7>{
-\begin{textblock}{1}(1,1.5)
-\begin{bubble}[4cm]
-\normalsize
-code generator:\smallskip\\
-\hspace{5mm}\code{istore 2}\\
-\hspace{5mm}\code{iload 2}\\
-\hspace{5mm}\code{ldc 10}\\
-\hspace{5mm}\code{isub}\\
-\hspace{5mm}\code{ifeq Label2}\\
-\hspace{5mm}\code{iload 2}\\
-\hspace{5mm}\code{...}\\
-\end{bubble}
-\end{textblock}}
-
-\only<7>{
-\begin{textblock}{6}(8.4,7)
-\begin{bubble}[5cm]
-\mbox{\begin{tikzpicture}[scale=0.58,rounded corners=0mm]
-\begin{axis}[axis x line=bottom, axis y line=left, ylabel=secs,
- xlabel=n,
- enlargelimits=0.05,
- ybar interval=0.7, legend style=small]
-\addplot file {interpreted2.data};
-\addplot file {compiled2.data};
-%\legend{interpreted, compiled}
+\begin{center}
+\begin{tikzpicture}
+\begin{axis}[
+ xlabel={$n$},
+ x label style={at={(1.05,0.0)}},
+ ylabel={regex size},
+ enlargelimits=false,
+ xtick={1,4,...,30},
+ xmax=33,
+ %ytick={0, 10,...,100},
+ scaled ticks=false,
+ axis lines=left,
+ width=9cm,
+ height=4.5cm,
+ legend entries={Simplification Applied},
+ legend pos= south east,
+ legend cell align=left
+]
+%\addplot[black,mark=square*, mark options={fill=white}] table {re-usize.data};
+\addplot[black,mark=triangle*, mark options={fill=white}] table {re-ssize.data};
+%\addplot[red,mark=triangle*,mark options={fill=white}] table {re1.data};
+%\addplot[green,mark=square*,mark options={fill=white}] table {re2.data};
\end{axis}
-\end{tikzpicture}}
-\end{bubble}
-\end{textblock}}
-
-\end{frame}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[c]
-\frametitle{The Acad.~Subject is Mature}
-
+\end{tikzpicture}
+\end{center}
\begin{itemize}
-\item Turing Machines, 1936
-\item Regular Expressions, 1956\\
-\item The first compiler for COBOL, 1957\\ (Grace Hopper)
-\item But surprisingly research papers are still published nowadays\\
-\item ``Parsing: The Solved Problem That Isn't''
+\item
+Lexer? Not just matcher
+\begin{itemize}
+\item
+Bit-Coded Regular Expression Parsing (Lasse Nielsen, Fritz Henglein 2011)
+\item
+Bit-Coded Regular Expression Parsing with Simplification (Sulzmann and Lu 2014)
\end{itemize}
-\begin{flushright}
-\includegraphics[scale=0.3]{hopper.jpg}\\
-\footnotesize\textcolor{gray}{Grace Hopper}
-\end{flushright}
+\end{itemize}
+\end{frame}
-\begin{flushright}
-\mbox{}\\[-6mm]
-{\footnotesize\textcolor{gray}{(she made it to David Letterman's Tonight Show,\\[-2mm]
- \url{http://www.youtube.com/watch?v=aZOxtURhfEU})}}
-\end{flushright}
-\end{frame}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[c]
-\frametitle{Lectures 1 - 5}
-transforming strings into structured data\\[10mm]
-
-{\LARGE\bf Lexing} {\hfill{}based on regular expressions}\medskip\\
-\hspace{5mm}(recognising ``words'')\\[6mm]
-
-{\LARGE\bf Parsing}\medskip\\
-\hspace{5mm}(recognising ``sentences'')
-
-\begin{textblock}{1}(10,9.1)
-\begin{tabular}{c}
-\includegraphics[scale=0.1]{rosetta.jpg}\\[-2mm]
-\footnotesize Stone of Rosetta
-\end{tabular}
-\end{textblock}
-
-\end{frame}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t]
-\frametitle{Familiar Regular Expr.}
-\small
-\begin{center}
-\texttt{[a-z0-9\_$\backslash{}$.-]+ @ [a-z0-9$\backslash{}$.-]+ . [a-z$\backslash{}$.]\{2,6\}}
-\end{center}\smallskip
-
-\begin{center}
-\begin{tabular}{@{}lp{8.5cm}@{}}
-\pcode{re*} & matches 0 or more times\\
-\pcode{re+} & matches 1 or more times\\
-\pcode{re?} & matches 0 or 1 times\\
-\pcode{re\{n\}} & matches exactly \pcode{n} number of times\\
-\pcode{re\{n,m\}} & matches at least \pcode{n} and at most {\tt m} times\\
-\pcode{[...]} & matches any single character inside the brackets\\
-\pcode{[^...]} & matches any single character not inside the
-brackets\\
-\pcode{a-z A-Z} & character ranges\\
-\pcode{\\d} & matches digits; equivalent to \pcode{[0-9]}\\
-\pcode{.} & matches every character except newline\\
-\pcode{(re)} & groups regular expressions and remembers
-the matched text
-\end{tabular}
-\end{center}
+\frametitle{Ongoing Work}
-\end{frame}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[c]
-\frametitle{Today}
-
-\begin{itemize}
-\item While the ultimate goal is to implement a small compiler for the JVM
- \ldots\bigskip
-\end{itemize}
-
-Let's start with:
+\begin{tikzpicture}
+\begin{semilogyaxis}[
+ xlabel={$n$},
+ x label style={at={(1.05,0.0)}},
+ ylabel={regex size},
+ enlargelimits=false,
+ xtick={1,4,...,30},
+ xmax=33,
+ %ytick={0, 10,...,100},
+ scaled ticks=false,
+ axis lines=left,
+ width=9cm,
+ height=4.5cm,
+ legend entries={Naive, Simp},
+ legend pos= north west,
+ legend cell align=left
+]
+\addplot[black,mark=square*, mark options={fill=white}] table {re-usize.data};
+\addplot[black,mark=triangle*, mark options={fill=white}] table {re-ssize.data};
+%\addplot[red,mark=triangle*,mark options={fill=white}] table {re1.data};
+%\addplot[green,mark=square*,mark options={fill=white}] table {re2.data};
+\end{semilogyaxis}
+\end{tikzpicture}
\begin{itemize}
-\item a web-crawler
-\item an email harvester
-%\item \textcolor{gray}{(a web-scraper)}
-\end{itemize}
-
-\end{frame}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\item
+Correctness of Sulzmann \& Lu's algorithm
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[t]
-\frametitle{A Web-Crawler}
-
-\mbox{}\\[10mm]
-
-\begin{enumerate}
-\item given an URL, read the corresponding webpage
-\item extract all links from it
-\item call the web-crawler again for all these links
-\end{enumerate}
-
+\item
+Size Bound $O(n^2t^2)$ of Dervatives (1995 Antimirov "Partial Derivative")
+\item
+More radical simplifications.
+\item
+Extend the algorithm to back-references.
+\end{itemize}
\end{frame}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[t]
-\frametitle{A Web-Crawler}
-
-\mbox{}\\[10mm]
-
-
-\begin{enumerate}
-\item given an URL, read the corresponding webpage
-\item if not possible print, out a problem
-\item if possible, extract all links from it
-\item call the web-crawler again for all these links
-\end{enumerate}\bigskip\pause
-
-\small (we need a bound for the number of recursive calls)
-
-\small (the purpose is to check all links on my own webpage)
-\end{frame}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[c]
-
-\begin{textblock}{1}(2,5)
-\begin{tabular}{c}
-\includegraphics[scale=0.15]{servers.png}\\[-2mm]
-\small Server
-\end{tabular}
-\end{textblock}
-
-\begin{textblock}{1}(5.6,4)
- \begin{tikzpicture}[scale=1.1]
- \draw[white] (0,1) node (X) {};
- \draw[white] (2,1) node (Y) {};
- \draw[white] (0,0) node (X1) {};
- \draw[white] (2,0) node (Y1) {};
- \draw[white] (0,-1) node (X2) {};
- \draw[white] (2,-1) node (Y2) {};
- \draw[red, <-, line width = 2mm] (X) -- (Y);
- \node [inner sep=5pt,label=above:\textcolor{black}{GET request}] at ($ (X)!.5!(Y) $) {};
- \draw[red, ->, line width = 2mm] (X1) -- (Y1);
- \node [inner sep=5pt,label=above:\textcolor{black}{webpage}] at ($ (X1)!.5!(Y1) $) {};
- \draw[red, <-, line width = 2mm] (X2) -- (Y2);
- \node [inner sep=7pt,label=above:\textcolor{black}{POST data}] at ($ (X2)!.5!(Y2) $) {};
- \end{tikzpicture}
-\end{textblock}
-\begin{textblock}{1}(9,5.5)
-\begin{tabular}{c}
-\includegraphics[scale=0.15]{laptop.png}\\[-2mm]
-\small Browser
-\end{tabular}
-\end{textblock}
-\end{frame}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-
-
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[t]
-\frametitle{A Regular Expression}
-
-\begin{itemize}
-\item \ldots{} is a pattern or template for specifying strings
-\end{itemize}\bigskip
-
-\begin{center}
-\only<1>{\scode{"https?://[^"]*"}}%
-\only<2>{\scode{""""https?://[^"]*"""".r}}
-\end{center}\bigskip\bigskip
-
-matches for example\smallskip\\
-\hspace{2mm}\code{"http://www.foobar.com"}\\
-\hspace{2mm}\code{"https://www.tls.org"}\smallskip\\
-
-but not\smallskip\\
-\hspace{2mm}\code{"http://www."foo"bar.com"}\\
-
-\end{frame}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[c]
-\frametitle{Finding Operations in Scala}
-
-{\bf\code{rexp.findAllIn(string)}}\medskip
-
-returns a list of all (sub)strings that match the
-regular expression
-\bigskip\bigskip
-
-
-{\bf\code{rexp.findFirstIn(string)}}\medskip
-
-returns either
-
-\begin{itemize}
-\item \code{None} if no (sub)string matches or
-\item \code{Some(s)} with the first (sub)string
-\end{itemize}
-
-\end{frame}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[t]
-\frametitle{Regular Expressions}
-
-Their inductive definition:
-\begin{textblock}{6}(2,7.5)
- \begin{tabular}{@ {}rrl@ {\hspace{13mm}}l}
- \bl{$r$} & \bl{$::=$} & \bl{$\ZERO$} & nothing\\
- & \bl{$\mid$} & \bl{$\ONE$} & empty string / \pcode{""} / $[]$\\
- & \bl{$\mid$} & \bl{$c$} & character\\
- & \bl{$\mid$} & \bl{$r_1 + r_2$} & alternative / choice\\
- & \bl{$\mid$} & \bl{$r_1 \cdot r_2$} & sequence\\
- & \bl{$\mid$} & \bl{$r^*$} & star (zero or more)\\
- \end{tabular}
- \end{textblock}
-
-
-
-\end{frame}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%\begin{frame}[t]
-%\frametitle{Regular Expressions}
-%
-%\small
-%In Scala:\bigskip
-%
-%\footnotesize
-%\lstinputlisting{../progs/app51.scala}
-%
-%
-%\end{frame}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[t]
-\frametitle{Strings}
-
-\ldots are lists of characters. For example \code{"hello"}
-
-\begin{center}
-\bl{$[h, e, l, l, o]$} or just \bl{$hello$}
-\end{center}
-
-the empty string: \bl{$[]$} or \bl{\pcode{""}}\bigskip\\
-
-the concatenation of two strings:
-
-\begin{center}
-\bl{$s_1 \,@\, s_2$}
-\end{center}
-
-\bl{\textit{foo $@$ bar = foobar}, \textit{baz $@\, []$ = baz}}
-
-\end{frame}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[c]
-\frametitle{Languages, Strings}
-
-\begin{itemize}
-\item \alert{\bf Strings} are lists of characters, for example
-\begin{center}
-\bl{$[]$},\;\bl{$abc$} \hspace{2cm}(Pattern match: \bl{$c\!::\!s$})
-\end{center}\bigskip
-
-
-\item A \alert{\bf language} is a set of strings, for example\medskip
-\begin{center}
-\bl{$\{[], hello, \textit{foobar}, a, abc\}$}
-\end{center}\bigskip
-
-\item \alert{\bf Concatenation} of strings and languages
-
-\begin{center}
-\begin{tabular}{rcl}
-\bl{$\textit{foo}\;@\;bar$} & \bl{$=$} & \bl{$\textit{foobar}$}\medskip\\
-\bl{$A\;@\;B$} & \bl{$\dn$} & \bl{$\{ s_1\,@\,s_2 \;\mid\; s_1 \in A \wedge s_2 \in B\}$}
-\end{tabular}
-\end{center}
-
-%\item The \alert{\bf meaning} of a regular expression is a set of
-% strings, or language.
-\end{itemize}
-
-\end{frame}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\mode<presentation>{
-\begin{frame}[c]
-\frametitle{\begin{tabular}{c}The Meaning of a\\[-2mm]
- Regular Expression\end{tabular}}
-\begin{textblock}{15}(1,4)
- \begin{tabular}{rcl}
- \bl{$L(\ZERO)$} & \bl{$\dn$} & \bl{$\{\}$}\\
- \bl{$L(\ONE)$} & \bl{$\dn$} & \bl{$\{[]\}$}\\
- \bl{$L(c)$} & \bl{$\dn$} & \bl{$\{[c]\}$}\\
- \bl{$L(r_1 + r_2)$} & \bl{$\dn$} & \bl{$L(r_1) \cup L(r_2)$}\\
- \bl{$L(r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{$\{ s_1 \,@\, s_2 \;|\; s_1 \in L(r_1) \wedge s_2 \in L(r_2) \}$}\\
- \bl{$L(r^*)$} & \bl{$\dn$} & \onslide<4->{\bl{$\bigcup_{0 \le n} L(r)^n$}}\\
- \end{tabular}\bigskip
-
-\onslide<2->{
-\hspace{5mm}\bl{$L(r)^0 \;\dn\; \{[]\}$}\\
-\bl{$L(r)^{n+1} \;\dn\; L(r) \,@\, L(r)^n$}\hspace{9mm}\onslide<3->{\small\textcolor{gray}{(append on sets)}\\
-\small\hspace{5cm}\textcolor{gray}{$\{ s_1 @ s_2 \;|\; s_1\in L(r) \wedge s_2 \in L(r)^n \}$}}
-}
- \end{textblock}
-
-\end{frame}}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[c]
-\frametitle{The Meaning of Matching}
-
-\begin{bubble}[10cm]
-\large\bf
-A regular expression \bl{$r$} matches a string~\bl{$s$}
-provided
-
-\begin{center}
-\bl{$s \in L(r)$}\\
-\end{center}
-\end{bubble}\bigskip\bigskip
-
-\ldots and the point of the next lecture is
-to decide this problem as fast as possible (unlike Python,
-Ruby, Java)
-
-\end{frame}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[c]
-\frametitle{Written Exam}
-
-\begin{itemize}
-\item Accounts for 80\%.\bigskip
-
-\item The question ``\textit{Is this relevant for
- the exam?}'' is very demotivating for the lecturer!\bigskip\\
-
-\item Deal: Whatever is in the homework (and is not marked
- ``\textit{optional}'') is relevant for the exam.\bigskip
-
-\item Each lecture has also a handout. There are also handouts about
-notation and Scala.
-\end{itemize}
-
-\end{frame}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[t]
-\frametitle{Coursework}
-
-\begin{itemize}
-\item Accounts for 20\%. Two strands. Choose \alert{\bf one}!\bigskip
-\end{itemize}
-
-\begin{columns}[t]
-\begin{column}{.5\textwidth}
-\underline{\bf Strand 1}\medskip
-\begin{itemize}
-\item four programming tasks:
-\begin{itemize}
-\item matcher (4\%, 12.10.)
-\item lexer (5\%, 02.11.)
-\item parser (5\%, 23.11.)
-\item compiler (6\%, 14.12.)
-\end{itemize}
-\item in any lang.~you like,\\ but I want to see the code
-\end{itemize}
-\end{column}
-
-\hspace{-45pt}\vrule{}\hspace{10pt}
-\begin{column}{.5\textwidth}
-\underline{\bf Strand 2}\smallskip\begin{itemize}
-\item one task: prove the correctness of a regular expression matcher in
-the \underline{Isabelle} theorem prover
-\item 20\%, submission on~14.12.\hspace{-5mm}\mbox{}
-\end{itemize}
-\end{column}
-\end{columns}\medskip
-
-\small
-\begin{itemize}
-\item Solving more than one strand will {\bf not} give you more
-marks.
-
-\end{itemize}
-
-\end{frame}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[c]
-\frametitle{Lecture Capture}
-
-\begin{itemize}
-\item Hope it works\ldots\pause actually no, it does not!\medskip\pause
-\item It is important to use lecture capture wisely\\ (it is only the ``baseline''):
-\begin{itemize}
-\item Lecture recordings are a study and revision aid.
-\item Statistically, there is a clear and direct link between attendance and
- attainment: Students who do not attend lectures, do less well in exams.
-\end{itemize}
-
-\item Attending a lecture is more than watching it online -- if you do not
-attend, you miss out!
-
-\end{itemize}
-
-\end{frame}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%