# HG changeset patch # User Christian Urban # Date 1601337103 -3600 # Node ID b294cfbb5c01536c670099533a8d56c4acf19357 # Parent 6718ef6143b8fbc8f2d17428c0608571528263ac updated diff -r 6718ef6143b8 -r b294cfbb5c01 handouts/ho01.pdf Binary file handouts/ho01.pdf has changed diff -r 6718ef6143b8 -r b294cfbb5c01 progs/matcher/re1.sc --- 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')) diff -r 6718ef6143b8 -r b294cfbb5c01 progs/pow.scala --- 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) +*/ diff -r 6718ef6143b8 -r b294cfbb5c01 slides/slides01.pdf Binary file slides/slides01.pdf has changed diff -r 6718ef6143b8 -r b294cfbb5c01 slides/slides02.pdf Binary file slides/slides02.pdf has changed diff -r 6718ef6143b8 -r b294cfbb5c01 slides/slides02.tex --- 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] diff -r 6718ef6143b8 -r b294cfbb5c01 videos/01-evilregexes.srt --- 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