updated
authorChristian Urban <christian.urban@kcl.ac.uk>
Tue, 29 Sep 2020 00:51:43 +0100
changeset 765 b294cfbb5c01
parent 764 6718ef6143b8
child 766 e8402d8ec8e6
updated
handouts/ho01.pdf
progs/matcher/re1.sc
progs/pow.scala
slides/slides01.pdf
slides/slides02.pdf
slides/slides02.tex
videos/01-evilregexes.srt
Binary file handouts/ho01.pdf has changed
--- a/progs/matcher/re1.sc	Sun Sep 27 09:15:32 2020 +0100
+++ b/progs/matcher/re1.sc	Tue Sep 29 00:51:43 2020 +0100
@@ -66,7 +66,7 @@
 
 
 // the optional regular expression (one or zero times)
-def OPT(r: Rexp) = ALT(r, ONE)
+def OPT(r: Rexp) = ALT(r, ONE)   // r + 1
 
 // the n-times regular expression (explicitly expanded)
 def NTIMES(r: Rexp, n: Int) : Rexp = n match {
@@ -79,8 +79,9 @@
 // Test Cases
 //============
 
-// the evil regular expression  a?{n} a{n}
-def EVIL1(n: Int) = SEQ(NTIMES(OPT(CHAR('a')), n), NTIMES(CHAR('a'), n))
+// the evil regular expression  (a?){n} a{n}
+def EVIL1(n: Int) = 
+  SEQ(NTIMES(OPT(CHAR('a')), n), NTIMES(CHAR('a'), n))
 
 // the evil regular expression (a*)* b
 val EVIL2 = SEQ(STAR(STAR(CHAR('a'))), CHAR('b'))
--- a/progs/pow.scala	Sun Sep 27 09:15:32 2020 +0100
+++ b/progs/pow.scala	Tue Sep 29 00:51:43 2020 +0100
@@ -62,3 +62,25 @@
 val B = Set("a", "b", "")
 pow(B, 4)
 pow(B, 4).size
+
+
+
+val SA = Set("a", "b", "c", "d")
+val SB = Set("0", "1", "2", "3", "4", "5", "6")
+
+concat(SA, SB).size
+
+
+val SA2 = Set("ab", "a", "c", "d")
+val SB2 = Set("bc", "c", "2", "3", "4", "5", "6")
+
+concat(SA2, SB2).size
+
+
+/*
+((a b) c) d
+a (b (c d))
+(a b) (c d)
+(a (b c)) d
+a ((b c) d)
+*/
Binary file slides/slides01.pdf has changed
Binary file slides/slides02.pdf has changed
--- a/slides/slides02.tex	Sun Sep 27 09:15:32 2020 +0100
+++ b/slides/slides02.tex	Tue Sep 29 00:51:43 2020 +0100
@@ -456,6 +456,7 @@
 
 \begin{center}
 \begin{mybox3}{}
+\centering    
 \bl{$\textit{matcher}\,r\,s \dn \textit{nullable}(\ders\;s\;r)$}
 \end{mybox3}
 \end{center}
@@ -521,6 +522,40 @@
 \end{frame}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{frame}[c]
+\frametitle{\boldmath\;$a^{?\{n\}} \cdot a^{\{n\}}$}
+
+\begin{center}
+\begin{tikzpicture}
+\begin{axis}[
+    xlabel={$n$},
+    x label style={at={(1.05,0.0)}},
+    ylabel={time in secs},
+    enlargelimits=false,
+    xtick={0,5,...,30},
+    xmax=31,
+    ytick={0,5,...,30},
+    scaled ticks=false,
+    axis lines=left,
+    width=7cm,
+    height=7cm, 
+    legend entries={Python,Ruby},  
+    legend pos=outer north east,
+    legend cell align=left  
+]
+\addplot[blue,mark=*, mark options={fill=white}] 
+  table {re-python.data};
+\addplot[brown,mark=pentagon*, mark options={fill=white}] 
+  table {re-ruby.data};    
+\end{axis}
+\end{tikzpicture}
+\end{center}
+
+\end{frame}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
+
+
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{frame}[c]
--- a/videos/01-evilregexes.srt	Sun Sep 27 09:15:32 2020 +0100
+++ b/videos/01-evilregexes.srt	Tue Sep 29 00:51:43 2020 +0100
@@ -951,7 +951,7 @@
 
 210
 00:10:41,480 --> 00:10:43,550
-I'm using here Scala aid,
+I'm using here Java 8,
 
 211
 00:10:43,550 --> 00:10:46,085