0
|
1 |
\documentclass[dvipsnames,14pt,t]{beamer}
|
|
2 |
\usepackage{beamerthemeplainculight}
|
|
3 |
\usepackage[T1]{fontenc}
|
|
4 |
\usepackage[latin1]{inputenc}
|
|
5 |
\usepackage{mathpartir}
|
|
6 |
\usepackage[absolute,overlay]{textpos}
|
|
7 |
\usepackage{ifthen}
|
|
8 |
\usepackage{tikz}
|
|
9 |
\usepackage{pgf}
|
|
10 |
\usepackage{calc}
|
|
11 |
\usepackage{ulem}
|
|
12 |
\usepackage{courier}
|
|
13 |
\usepackage{listings}
|
|
14 |
\renewcommand{\uline}[1]{#1}
|
|
15 |
\usetikzlibrary{arrows}
|
|
16 |
\usetikzlibrary{automata}
|
|
17 |
\usetikzlibrary{shapes}
|
|
18 |
\usetikzlibrary{shadows}
|
|
19 |
\usetikzlibrary{positioning}
|
|
20 |
\usetikzlibrary{calc}
|
|
21 |
\usepackage{graphicx}
|
|
22 |
|
|
23 |
\definecolor{javared}{rgb}{0.6,0,0} % for strings
|
|
24 |
\definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments
|
|
25 |
\definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords
|
|
26 |
\definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc
|
|
27 |
|
|
28 |
\lstset{language=Java,
|
|
29 |
basicstyle=\ttfamily,
|
|
30 |
keywordstyle=\color{javapurple}\bfseries,
|
|
31 |
stringstyle=\color{javagreen},
|
|
32 |
commentstyle=\color{javagreen},
|
|
33 |
morecomment=[s][\color{javadocblue}]{/**}{*/},
|
|
34 |
numbers=left,
|
|
35 |
numberstyle=\tiny\color{black},
|
|
36 |
stepnumber=1,
|
|
37 |
numbersep=10pt,
|
|
38 |
tabsize=2,
|
|
39 |
showspaces=false,
|
|
40 |
showstringspaces=false}
|
|
41 |
|
|
42 |
\lstdefinelanguage{scala}{
|
|
43 |
morekeywords={abstract,case,catch,class,def,%
|
|
44 |
do,else,extends,false,final,finally,%
|
|
45 |
for,if,implicit,import,match,mixin,%
|
|
46 |
new,null,object,override,package,%
|
|
47 |
private,protected,requires,return,sealed,%
|
|
48 |
super,this,throw,trait,true,try,%
|
|
49 |
type,val,var,while,with,yield},
|
|
50 |
otherkeywords={=>,<-,<\%,<:,>:,\#,@},
|
|
51 |
sensitive=true,
|
|
52 |
morecomment=[l]{//},
|
|
53 |
morecomment=[n]{/*}{*/},
|
|
54 |
morestring=[b]",
|
|
55 |
morestring=[b]',
|
|
56 |
morestring=[b]"""
|
|
57 |
}
|
|
58 |
|
|
59 |
\lstset{language=Scala,
|
|
60 |
basicstyle=\ttfamily,
|
|
61 |
keywordstyle=\color{javapurple}\bfseries,
|
|
62 |
stringstyle=\color{javagreen},
|
|
63 |
commentstyle=\color{javagreen},
|
|
64 |
morecomment=[s][\color{javadocblue}]{/**}{*/},
|
|
65 |
numbers=left,
|
|
66 |
numberstyle=\tiny\color{black},
|
|
67 |
stepnumber=1,
|
|
68 |
numbersep=10pt,
|
|
69 |
tabsize=2,
|
|
70 |
showspaces=false,
|
|
71 |
showstringspaces=false}
|
|
72 |
|
|
73 |
% beamer stuff
|
1
|
74 |
\renewcommand{\slidecaption}{AFL 01, King's College London, 26.~September 2012}
|
0
|
75 |
|
|
76 |
|
|
77 |
\begin{document}
|
|
78 |
|
|
79 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
80 |
\mode<presentation>{
|
|
81 |
\begin{frame}<1>[t]
|
|
82 |
\frametitle{%
|
|
83 |
\begin{tabular}{@ {}c@ {}}
|
1
|
84 |
\\[-3mm]
|
|
85 |
\LARGE Automata and \\[-2mm]
|
|
86 |
\LARGE Formal Languages (1)\\[-3mm]
|
0
|
87 |
\end{tabular}}
|
|
88 |
|
|
89 |
\begin{center}
|
1
|
90 |
\includegraphics[scale=0.3]{pics/ante1.jpg}\hspace{5mm}
|
|
91 |
\includegraphics[scale=0.31]{pics/ante2.jpg}\\
|
|
92 |
\footnotesize\textcolor{gray}{Antikythera automaton, 100 BC (Archimedes?)}
|
0
|
93 |
\end{center}
|
|
94 |
|
|
95 |
\normalsize
|
|
96 |
\begin{center}
|
|
97 |
\begin{tabular}{ll}
|
|
98 |
Email: & christian.urban at kcl.ac.uk\\
|
|
99 |
Of$\!$fice: & S1.27 (1st floor Strand Building)\\
|
|
100 |
Slides: & KEATS
|
|
101 |
\end{tabular}
|
|
102 |
\end{center}
|
|
103 |
|
|
104 |
|
|
105 |
\end{frame}}
|
|
106 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
107 |
|
|
108 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
109 |
\mode<presentation>{
|
|
110 |
\begin{frame}[c]
|
|
111 |
|
1
|
112 |
\begin{textblock}{1}(2,5)
|
0
|
113 |
\begin{tabular}{c}
|
1
|
114 |
\includegraphics[scale=0.15]{pics/servers.png}\\[-2mm]
|
|
115 |
\small Server
|
0
|
116 |
\end{tabular}
|
|
117 |
\end{textblock}
|
|
118 |
|
1
|
119 |
\begin{textblock}{1}(5.6,4)
|
|
120 |
\begin{tikzpicture}[scale=1.1]
|
|
121 |
\draw[white] (0,1) node (X) {};
|
|
122 |
\draw[white] (2,1) node (Y) {};
|
|
123 |
\draw[white] (0,0) node (X1) {};
|
|
124 |
\draw[white] (2,0) node (Y1) {};
|
|
125 |
\draw[white] (0,-1) node (X2) {};
|
|
126 |
\draw[white] (2,-1) node (Y2) {};
|
|
127 |
\draw[red, <-, line width = 2mm] (X) -- (Y);
|
|
128 |
\node [inner sep=5pt,label=above:\textcolor{black}{GET request}] at ($ (X)!.5!(Y) $) {};
|
|
129 |
\draw[red, ->, line width = 2mm] (X1) -- (Y1);
|
|
130 |
\node [inner sep=5pt,label=above:\textcolor{black}{webpage}] at ($ (X1)!.5!(Y1) $) {};
|
|
131 |
\draw[red, <-, line width = 2mm] (X2) -- (Y2);
|
|
132 |
\node [inner sep=7pt,label=above:\textcolor{black}{POST data}] at ($ (X2)!.5!(Y2) $) {};
|
0
|
133 |
\end{tikzpicture}
|
|
134 |
\end{textblock}
|
|
135 |
|
|
136 |
|
1
|
137 |
\begin{textblock}{1}(9,5.5)
|
0
|
138 |
\begin{tabular}{c}
|
1
|
139 |
\includegraphics[scale=0.15]{pics/laptop.png}\\[-2mm]
|
|
140 |
\small Browser
|
0
|
141 |
\end{tabular}
|
|
142 |
\end{textblock}
|
|
143 |
|
1
|
144 |
\only<2>{
|
|
145 |
\begin{textblock}{10}(2,13.5)
|
0
|
146 |
\begin{itemize}
|
1
|
147 |
\item programming languages, compilers
|
0
|
148 |
\end{itemize}
|
1
|
149 |
\end{textblock}}
|
0
|
150 |
|
|
151 |
|
|
152 |
\end{frame}}
|
|
153 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
154 |
|
|
155 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
156 |
\mode<presentation>{
|
|
157 |
\begin{frame}[c]
|
1
|
158 |
|
|
159 |
transforming strings into structured data\\[10mm]
|
0
|
160 |
|
1
|
161 |
{\LARGE\bf Lexing}\medskip\\
|
|
162 |
\hspace{5mm}(recognising ``words'')\\[6mm]
|
0
|
163 |
|
1
|
164 |
{\LARGE\bf Parsing}\medskip\\
|
|
165 |
\hspace{5mm}(recognising ``sentences'')
|
|
166 |
|
0
|
167 |
\end{frame}}
|
1
|
168 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
169 |
|
0
|
170 |
|
|
171 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
172 |
\mode<presentation>{
|
|
173 |
\begin{frame}[c]
|
|
174 |
|
1
|
175 |
The subject is quite old:
|
0
|
176 |
|
|
177 |
\begin{itemize}
|
1
|
178 |
\item Turing Machines, 1936
|
|
179 |
\item first compiler for COBOL, 1957 (Grace Hopper)
|
|
180 |
\item but surprisingly research papers are still published now
|
0
|
181 |
\end{itemize}
|
|
182 |
|
1
|
183 |
\begin{flushright}
|
|
184 |
\includegraphics[scale=0.3]{pics/hopper.jpg}\\
|
|
185 |
\footnotesize\textcolor{gray}{Grace Hopper}
|
|
186 |
\end{flushright}
|
|
187 |
|
|
188 |
{\footnotesize\textcolor{gray}{(she made it to David Letterman's Tonight Show, \url{http://www.youtube.com/watch?v=aZOxtURhfEU})}}
|
0
|
189 |
|
1
|
190 |
\end{frame}}
|
|
191 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
192 |
|
|
193 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
194 |
\mode<presentation>{
|
|
195 |
\begin{frame}[c]
|
|
196 |
\frametitle{\begin{tabular}{c}This Course\end{tabular}}
|
0
|
197 |
|
1
|
198 |
\begin{itemize}
|
3
|
199 |
\item the ultimate goal is to implement a small web-browser (really small one)\bigskip
|
1
|
200 |
\end{itemize}
|
|
201 |
|
|
202 |
Let's start with:
|
|
203 |
|
|
204 |
\begin{itemize}
|
|
205 |
\item a web-crawler
|
|
206 |
\item an email harvester
|
|
207 |
\item a web-scraper
|
|
208 |
\end{itemize}
|
|
209 |
|
|
210 |
\end{frame}}
|
|
211 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
0
|
212 |
|
2
|
213 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
214 |
\mode<presentation>{
|
3
|
215 |
\begin{frame}[t]
|
2
|
216 |
\frametitle{\begin{tabular}{c}A Web Crawler\end{tabular}}
|
|
217 |
|
3
|
218 |
\mbox{}\\[10mm]
|
|
219 |
|
2
|
220 |
\begin{enumerate}
|
|
221 |
\item given an URL, read the corresponding webpage
|
|
222 |
\item extract all links from it
|
|
223 |
\item call the web-crawler again for all these links
|
|
224 |
\end{enumerate}
|
|
225 |
|
|
226 |
\end{frame}}
|
|
227 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
228 |
|
|
229 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
230 |
\mode<presentation>{
|
3
|
231 |
\begin{frame}[t]
|
2
|
232 |
\frametitle{\begin{tabular}{c}A Web Crawler\end{tabular}}
|
|
233 |
|
3
|
234 |
\mbox{}\\[10mm]
|
|
235 |
|
|
236 |
|
2
|
237 |
\begin{enumerate}
|
|
238 |
\item given an URL, read the corresponding webpage
|
|
239 |
\item if not possible print, out a problem
|
|
240 |
\item if possible, extract all links from it
|
|
241 |
\item call the web-crawler again for all these links
|
|
242 |
\end{enumerate}\bigskip\pause
|
|
243 |
|
3
|
244 |
\small (we need a bound for the number of recursive calls)
|
2
|
245 |
|
|
246 |
\small (the purpose is to check all links on my own webpage)
|
|
247 |
\end{frame}}
|
|
248 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
249 |
|
0
|
250 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
251 |
\mode<presentation>{
|
|
252 |
\begin{frame}[c]
|
1
|
253 |
\frametitle{\begin{tabular}{c}Scala\end{tabular}}
|
|
254 |
|
2
|
255 |
\footnotesize a simple Scala function for reading webpages\\[-3mm]
|
0
|
256 |
|
1
|
257 |
{\lstset{language=Scala}\fontsize{8}{10}\selectfont
|
3
|
258 |
\texttt{\lstinputlisting{app0.scala}}}\pause
|
|
259 |
{\lstset{language=Scala}\fontsize{8}{10}\selectfont
|
|
260 |
\texttt{\lstinline{get_page("""http://www.inf.kcl.ac.uk/staff/urbanc/""")}}}\pause\bigskip
|
0
|
261 |
|
3
|
262 |
|
|
263 |
\footnotesize slightly more complicated for handling errors properly:\\[-3mm]
|
2
|
264 |
|
1
|
265 |
\footnotesize
|
|
266 |
{\lstset{language=Scala}\fontsize{8}{10}\selectfont
|
|
267 |
\texttt{\lstinputlisting{app1.scala}}}
|
|
268 |
|
0
|
269 |
|
|
270 |
\end{frame}}
|
|
271 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
272 |
|
|
273 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
274 |
\mode<presentation>{
|
3
|
275 |
\begin{frame}[t]
|
|
276 |
\frametitle{\begin{tabular}{c}A Regular Expression\end{tabular}}
|
|
277 |
|
|
278 |
\begin{itemize}
|
|
279 |
\item \ldots{} is a pattern or template for specifying strings
|
|
280 |
\end{itemize}\bigskip
|
|
281 |
|
|
282 |
\begin{center}
|
|
283 |
\only<1>{{\lstset{language=Scala}\fontsize{18}{19}\selectfont\bf
|
|
284 |
\texttt{"https?://[$\hat{\hspace{2mm}}$"]*"}}}%
|
|
285 |
\only<2>{{\lstset{language=Scala}\fontsize{18}{19}\selectfont\bf
|
|
286 |
\texttt{"""\textbackslash{}"https?://[$\hat{\hspace{2mm}}$\textbackslash{}"]*\textbackslash{}"""".r}}}
|
|
287 |
\end{center}\bigskip\bigskip
|
|
288 |
|
|
289 |
matches for example\\
|
|
290 |
\;{\lstset{language=Scala}\fontsize{12}{14}\selectfont\bf
|
|
291 |
\texttt{"http://www.foobar.com"}}\\
|
|
292 |
\;{\lstset{language=Scala}\fontsize{12}{14}\selectfont\bf
|
|
293 |
\texttt{"https://www.tls.org"}}\\
|
|
294 |
|
|
295 |
\end{frame}}
|
|
296 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
297 |
|
|
298 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
299 |
\mode<presentation>{
|
0
|
300 |
\begin{frame}[c]
|
|
301 |
|
3
|
302 |
{\lstset{language=Scala}\fontsize{18}{19}\selectfont\bf
|
|
303 |
\texttt{rexp.findAllIn(string)}}\medskip
|
|
304 |
|
|
305 |
returns a list of all (sub)strings that match the regular expression\bigskip\bigskip
|
|
306 |
|
|
307 |
{\lstset{language=Scala}\fontsize{18}{19}\selectfont\bf
|
|
308 |
\texttt{rexp.findFirstIn(string)}}\medskip
|
|
309 |
|
|
310 |
returns either {\bf\texttt{None}} if no (sub)string matches
|
|
311 |
or {\bf\texttt{Some(s)}} with the first (sub)string
|
0
|
312 |
|
|
313 |
\end{frame}}
|
|
314 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
315 |
|
|
316 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
317 |
\mode<presentation>{
|
|
318 |
\begin{frame}[c]
|
|
319 |
|
3
|
320 |
{\lstset{language=Scala}\fontsize{8}{10}\selectfont
|
|
321 |
\texttt{\lstinputlisting{app2.scala}}}\medskip
|
0
|
322 |
|
3
|
323 |
{\lstset{language=Scala}\fontsize{8}{10}\selectfont
|
|
324 |
\texttt{crawl(some\_start\_URL, 2)}}\
|
0
|
325 |
|
|
326 |
\end{frame}}
|
|
327 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
328 |
|
|
329 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
330 |
\mode<presentation>{
|
3
|
331 |
\begin{frame}[c]
|
0
|
332 |
|
3
|
333 |
\footnotesize
|
|
334 |
a version that only ``crawls'' links in my domain:
|
0
|
335 |
|
3
|
336 |
{\lstset{language=Scala}\fontsize{8}{10}\selectfont
|
|
337 |
\texttt{\lstinputlisting{app3.scala}}}
|
0
|
338 |
|
|
339 |
|
|
340 |
\end{frame}}
|
|
341 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
342 |
|
|
343 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
344 |
\mode<presentation>{
|
|
345 |
\begin{frame}[c]
|
3
|
346 |
|
|
347 |
\footnotesize
|
|
348 |
a little email ``harvester'':
|
|
349 |
|
|
350 |
{\lstset{language=Scala}\fontsize{8}{10}\selectfont
|
|
351 |
\texttt{\lstinputlisting{app4.scala}}}\bigskip
|
|
352 |
|
|
353 |
\tiny
|
|
354 |
\textcolor{gray}{\url{http://net.tutsplus.com/tutorials/other/8-regular-expressions-you-should-know/}}
|
|
355 |
|
|
356 |
\end{frame}}
|
|
357 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
358 |
|
|
359 |
\newcommand{\bl}[1]{\textcolor{blue}{#1}}
|
|
360 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
361 |
\mode<presentation>{
|
|
362 |
\begin{frame}[c]
|
|
363 |
\frametitle{\begin{tabular}{c}Regular Expressions\end{tabular}}
|
0
|
364 |
|
3
|
365 |
\begin{textblock}{6}(2,4)
|
|
366 |
\begin{tabular}{@ {}rrl@ {\hspace{13mm}}l}
|
|
367 |
\bl{r} & \bl{$::=$} & \bl{$\varnothing$} & null\\
|
5
|
368 |
& \bl{$\mid$} & \bl{$\epsilon$} & empty string / "" / []\\
|
3
|
369 |
& \bl{$\mid$} & \bl{c} & character\\
|
|
370 |
& \bl{$\mid$} & \bl{r$_1$ $\cdot$ r$_2$} & sequence\\
|
|
371 |
& \bl{$\mid$} & \bl{r$_1$ + r$_2$} & alternative / choice\\
|
|
372 |
& \bl{$\mid$} & \bl{r$^*$} & star (zero or more)\\
|
|
373 |
\end{tabular}
|
|
374 |
\end{textblock}
|
|
375 |
|
|
376 |
\end{frame}}
|
|
377 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
378 |
|
|
379 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
380 |
\mode<presentation>{
|
|
381 |
\begin{frame}[t]
|
|
382 |
\frametitle{\begin{tabular}{c}Regular Expressions\end{tabular}}
|
|
383 |
|
|
384 |
{\lstset{language=Scala}\fontsize{8}{10}\selectfont
|
7
|
385 |
\texttt{\lstinputlisting{app51.scala}}}
|
0
|
386 |
|
|
387 |
|
|
388 |
\end{frame}}
|
|
389 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
390 |
|
3
|
391 |
\newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% for definitions
|
0
|
392 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
393 |
\mode<presentation>{
|
|
394 |
\begin{frame}[c]
|
3
|
395 |
\frametitle{\begin{tabular}{c}The Meaning of a\\[-2mm] Regular Expression\end{tabular}}
|
0
|
396 |
|
4
|
397 |
\begin{textblock}{15}(1,4)
|
3
|
398 |
\begin{tabular}{@ {}rcl}
|
|
399 |
\bl{$L$($\varnothing$)} & \bl{$\dn$} & \bl{$\varnothing$}\\
|
|
400 |
\bl{$L$($\epsilon$)} & \bl{$\dn$} & \bl{$\{$""$\}$}\\
|
|
401 |
\bl{$L$(c)} & \bl{$\dn$} & \bl{$\{$"c"$\}$}\\
|
|
402 |
\bl{$L$(r$_1$ + r$_2$)} & \bl{$\dn$} & \bl{$L$(r$_1$) $\cup$ $L$(r$_2$)}\\
|
4
|
403 |
\bl{$L$(r$_1$ $\cdot$ r$_2$)} & \bl{$\dn$} & \bl{$\{$ s$_1$ @ s$_2$ $|$ s$_1$ $\in$ $L$(r$_1$) $\wedge$ s$_2$ $\in$
|
|
404 |
$L$(r$_2$) $\}$}\\
|
5
|
405 |
\bl{$L$(r$^*$)} & \bl{$\dn$} & \onslide<4->{\bl{$\bigcup_{n \ge 0}$ $L$(r)$^n$}}\\
|
4
|
406 |
\end{tabular}\bigskip
|
3
|
407 |
|
4
|
408 |
\onslide<2->{
|
|
409 |
\hspace{5mm}\bl{$L$(r)$^0$ $\;\dn\;$ $\{$""$\}$}\\
|
5
|
410 |
\bl{$L$(r)$^{n+1}$ $\;\dn\;$ $L$(r) @ $L$(r)$^n$}\hspace{9mm}\onslide<3->{\small\textcolor{gray}{(append on sets)}\\
|
|
411 |
\small\hspace{5cm}\textcolor{gray}{$\{$ s$_1$ @ s$_2$ $|$ s$_1$ $\in$ $L$(r) $\wedge$ s$_2$ $\in$
|
|
412 |
$L$(r)$^n$ $\}$}}
|
4
|
413 |
}
|
|
414 |
\end{textblock}
|
|
415 |
|
0
|
416 |
\end{frame}}
|
|
417 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
418 |
|
5
|
419 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
420 |
\mode<presentation>{
|
|
421 |
\begin{frame}[c]
|
|
422 |
\frametitle{\begin{tabular}{c}The Meaning of a Matching\end{tabular}}
|
|
423 |
|
|
424 |
\large
|
|
425 |
a regular expression \bl{r} matches a string \bl{s} is defined as
|
|
426 |
|
|
427 |
\begin{center}
|
|
428 |
\bl{s $\in$ $L$(r)}\\
|
|
429 |
\end{center}
|
|
430 |
|
|
431 |
\end{frame}}
|
|
432 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
433 |
|
3
|
434 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
435 |
\mode<presentation>{
|
|
436 |
\begin{frame}[c]
|
|
437 |
\frametitle{\begin{tabular}{c}This Course\end{tabular}}
|
|
438 |
|
7
|
439 |
We will have a look at:
|
3
|
440 |
|
|
441 |
\begin{itemize}
|
7
|
442 |
\item regular expressions / regular expression matching
|
3
|
443 |
\item automata
|
|
444 |
\item the Myhill-Nerode theorem
|
|
445 |
\item parsing
|
|
446 |
\item grammars
|
7
|
447 |
\item a small interpreter / web browser
|
3
|
448 |
\end{itemize}
|
|
449 |
|
|
450 |
\end{frame}}
|
|
451 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
452 |
|
0
|
453 |
|
|
454 |
|
|
455 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
456 |
\mode<presentation>{
|
|
457 |
\begin{frame}[c]
|
1
|
458 |
\frametitle{\begin{tabular}{c}Exam\end{tabular}}
|
0
|
459 |
|
|
460 |
\begin{itemize}
|
7
|
461 |
\item The question ``Is this relevant for the exam?'' is not appreciated!\bigskip\\
|
0
|
462 |
|
|
463 |
Whatever is in the homework sheets (and is not marked optional) is relevant for the
|
1
|
464 |
exam.\\ No code needs to be written.
|
0
|
465 |
\end{itemize}
|
|
466 |
|
|
467 |
\end{frame}}
|
|
468 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
469 |
|
|
470 |
|
|
471 |
\end{document}
|
|
472 |
|
|
473 |
%%% Local Variables:
|
|
474 |
%%% mode: latex
|
|
475 |
%%% TeX-master: t
|
|
476 |
%%% End:
|
|
477 |
|