# HG changeset patch # User Christian Urban # Date 1443167472 -3600 # Node ID 0806e45d873c72b0a65bc1d2f4c63f1eb6fc5efd # Parent dbba38a5c2ae7df543c445b49e09486d024ab98f updated diff -r dbba38a5c2ae -r 0806e45d873c progs/app4.scala --- a/progs/app4.scala Fri Sep 25 07:35:37 2015 +0100 +++ b/progs/app4.scala Fri Sep 25 08:51:12 2015 +0100 @@ -1,5 +1,4 @@ val http_pattern = """"https?://[^"]*"""".r -val my_urls = """urbanc""".r val email_pattern = """([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})""".r diff -r dbba38a5c2ae -r 0806e45d873c slides/slides01.pdf Binary file slides/slides01.pdf has changed diff -r dbba38a5c2ae -r 0806e45d873c slides/slides01.tex --- a/slides/slides01.tex Fri Sep 25 07:35:37 2015 +0100 +++ b/slides/slides01.tex Fri Sep 25 08:51:12 2015 +0100 @@ -211,7 +211,7 @@ \end{tikzpicture} \end{column} \begin{column}{.5\textwidth} -Us (after this course)\\\mbox{}\bigskip\\ +Us (after next lecture)\\\mbox{}\bigskip\\ \begin{tikzpicture}[y=.08cm, x=.0003cm] %axis \draw (0,0) -- coordinate (x axis mid) (12000,0); @@ -559,19 +559,28 @@ \begin{frame}[t] \frametitle{\begin{tabular}{c}Regular Expressions\end{tabular}} -Their inductive definition:\medskip +Their inductive definition: + -\begin{textblock}{6}(2,5) - \begin{tabular}{rrl@ {\hspace{13mm}}l} - \bl{$r$} & \bl{$::=$} & \bl{$\varnothing$} & null\\ - & \bl{$\mid$} & \bl{$\epsilon$} & empty string / \pcode{""} / \pcode{[]}\\ - & \bl{$\mid$} & \bl{$c$} & character\\ - & \bl{$\mid$} & \bl{$r_1 \cdot r_2$} & sequence\\ - & \bl{$\mid$} & \bl{$r_1 + r_2$} & alternative / choice\\ - & \bl{$\mid$} & \bl{$r^*$} & star (zero or more)\\ +\begin{textblock}{6}(2,7.5) + \begin{tabular}{@ {}rrl@ {\hspace{13mm}}l} + \bl{$r$} & \bl{$::=$} & \bl{$\varnothing$} & null\\ + & \bl{$\mid$} & \bl{$\epsilon$} & 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} + +\only<2->{\footnotesize +\begin{textblock}{9}(2,0.5) +\begin{bubble}[9.8cm] +\lstinputlisting{../progs/app01.scala} +\end{bubble} +\end{textblock}} + \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -596,10 +605,10 @@ \ldots are lists of characters. For example \code{"hello"} \begin{center} -\bl{$[h, e, l, l, o]$} +\bl{$[h, e, l, l, o]$} or just \bl{$hello$} \end{center} -the empty string: $[]$ or \pcode{""}\bigskip\\ +the empty string: \bl{$[]$} or \bl{\pcode{""}}\bigskip\\ the concatenation of two strings: @@ -607,12 +616,45 @@ \bl{$s_1 \,@\, s_2$} \end{center} -\textit{foo $@$ bar = foobar}, \textit{baz $@\, []$ = baz} +\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 sets + +\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{ \begin{frame}[c] \frametitle{\begin{tabular}{c}The Meaning of a\\[-2mm] @@ -650,7 +692,11 @@ \begin{center} \bl{$s \in L(r)$}\\ \end{center} -\end{bubble} +\end{bubble}\bigskip\bigskip + +\ldots and the point of the next lecture is +to decide this problem as fast as possible (unlike Python, +Ruby) \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -663,11 +709,14 @@ \begin{itemize} \item Accounts for 75\%.\bigskip -\item You will understand the question ``Is this relevant for - the exam?'' is very demotivating for the lecturer!\bigskip\\ +\item You will understand 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 - ``optional'') is relevant for the exam. + ``\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}