author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Sun, 01 Dec 2013 09:58:41 +0000 | |
changeset 215 | 828303e8e4af |
parent 169 | 57df3d7b4a25 |
child 270 | 4dbeaf43031d |
permissions | -rw-r--r-- |
44 | 1 |
\documentclass[dvipsnames,14pt,t]{beamer} |
147
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
2 |
\usepackage{beamerthemeplaincu} |
44 | 3 |
\usepackage[absolute,overlay]{textpos} |
4 |
\usepackage{ifthen} |
|
5 |
\usepackage{tikz} |
|
6 |
\usepackage{pgf} |
|
7 |
\usepackage{calc} |
|
8 |
\usepackage{ulem} |
|
9 |
\usepackage{courier} |
|
10 |
\usepackage{listings} |
|
11 |
\renewcommand{\uline}[1]{#1} |
|
12 |
\usetikzlibrary{arrows} |
|
13 |
\usetikzlibrary{automata} |
|
14 |
\usetikzlibrary{shapes} |
|
15 |
\usetikzlibrary{shadows} |
|
16 |
\usetikzlibrary{positioning} |
|
17 |
\usetikzlibrary{calc} |
|
18 |
\usepackage{graphicx} |
|
148
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
19 |
\usepackage{pgfplots} |
153
70ab41cb610e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
151
diff
changeset
|
20 |
\usepackage{fontspec} |
215
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
169
diff
changeset
|
21 |
\usepackage{../langs} |
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
169
diff
changeset
|
22 |
\usepackage{../data} |
44 | 23 |
|
24 |
||
25 |
% beamer stuff |
|
147
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
26 |
\renewcommand{\slidecaption}{AFL 05, King's College London, 23.~October 2013} |
44 | 27 |
\newcommand{\bl}[1]{\textcolor{blue}{#1}} |
28 |
\newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% for definitions |
|
29 |
||
30 |
\begin{document} |
|
31 |
||
32 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
33 |
\mode<presentation>{ |
|
34 |
\begin{frame}<1>[t] |
|
35 |
\frametitle{% |
|
36 |
\begin{tabular}{@ {}c@ {}} |
|
37 |
\\[-3mm] |
|
38 |
\LARGE Automata and \\[-2mm] |
|
39 |
\LARGE Formal Languages (5)\\[3mm] |
|
40 |
\end{tabular}} |
|
41 |
||
42 |
\normalsize |
|
43 |
\begin{center} |
|
44 |
\begin{tabular}{ll} |
|
45 |
Email: & christian.urban at kcl.ac.uk\\ |
|
147
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
46 |
Office: & S1.27 (1st floor Strand Building)\\ |
44 | 47 |
Slides: & KEATS (also home work is there)\\ |
48 |
\end{tabular} |
|
49 |
\end{center} |
|
50 |
||
51 |
||
52 |
\end{frame}} |
|
53 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
54 |
||
55 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
56 |
\mode<presentation>{ |
|
147
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
57 |
\begin{frame}[c] |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
58 |
\frametitle{DFA Minimisation} |
44 | 59 |
|
147
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
60 |
\begin{enumerate} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
61 |
\item Take all pairs \bl{$(q, p)$} with \bl{$q \not= p$} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
62 |
\item Mark all pairs that accepting and non-accepting states |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
63 |
\item For all unmarked pairs \bl{$(q, p)$} and all characters \bl{$c$} tests wether |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
64 |
\begin{center} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
65 |
\bl{$(\delta(q, c), \delta(p,c))$} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
66 |
\end{center} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
67 |
are marked. If yes, then also mark \bl{$(q, p)$}. |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
68 |
\item Repeat last step until no chance. |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
69 |
\item All unmarked pairs can be merged. |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
70 |
\end{enumerate} |
44 | 71 |
|
147
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
72 |
\end{frame}} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
73 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
74 |
|
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
75 |
|
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
76 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
77 |
\mode<presentation>{ |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
78 |
\begin{frame}<1-2>[c] |
44 | 79 |
|
147
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
80 |
\begin{center} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
81 |
\begin{tikzpicture}[>=stealth',very thick,auto, |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
82 |
every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},] |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
83 |
\node[state,initial] (q_0) {$q_0$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
84 |
\node[state] (q_1) [right=of q_0] {$q_1$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
85 |
\node[state] (q_2) [below right=of q_0] {$q_2$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
86 |
\node[state] (q_3) [right=of q_2] {$q_3$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
87 |
\node[state, accepting] (q_4) [right=of q_1] {$q_4$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
88 |
\path[->] (q_0) edge node [above] {\alert{$a$}} (q_1); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
89 |
\path[->] (q_1) edge node [above] {\alert{$a$}} (q_4); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
90 |
\path[->] (q_4) edge [loop right] node {\alert{$a, b$}} (); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
91 |
\path[->] (q_3) edge node [right] {\alert{$a$}} (q_4); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
92 |
\path[->] (q_2) edge node [above] {\alert{$a$}} (q_3); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
93 |
\path[->] (q_1) edge node [right] {\alert{$b$}} (q_2); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
94 |
\path[->] (q_0) edge node [above] {\alert{$b$}} (q_2); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
95 |
\path[->] (q_2) edge [loop left] node {\alert{$b$}} (); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
96 |
\path[->] (q_3) edge [bend left=95, looseness=1.3] node [below] {\alert{$b$}} (q_0); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
97 |
\end{tikzpicture} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
98 |
\end{center} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
99 |
|
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
100 |
\mbox{}\\[-20mm]\mbox{} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
101 |
|
44 | 102 |
\begin{center} |
147
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
103 |
\begin{tikzpicture}[scale=0.8,line width=0.8mm] |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
104 |
\draw (0,0) -- (4,0); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
105 |
\draw (0,1) -- (4,1); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
106 |
\draw (0,2) -- (3,2); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
107 |
\draw (0,3) -- (2,3); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
108 |
\draw (0,4) -- (1,4); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
109 |
|
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
110 |
\draw (0,0) -- (0, 4); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
111 |
\draw (1,0) -- (1, 4); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
112 |
\draw (2,0) -- (2, 3); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
113 |
\draw (3,0) -- (3, 2); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
114 |
\draw (4,0) -- (4, 1); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
115 |
|
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
116 |
\draw (0.5,-0.5) node {$q_0$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
117 |
\draw (1.5,-0.5) node {$q_1$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
118 |
\draw (2.5,-0.5) node {$q_2$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
119 |
\draw (3.5,-0.5) node {$q_3$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
120 |
|
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
121 |
\draw (-0.5, 3.5) node {$q_1$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
122 |
\draw (-0.5, 2.5) node {$q_2$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
123 |
\draw (-0.5, 1.5) node {$q_3$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
124 |
\draw (-0.5, 0.5) node {$q_4$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
125 |
|
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
126 |
\draw (0.5,0.5) node {\large$\star$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
127 |
\draw (1.5,0.5) node {\large$\star$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
128 |
\draw (2.5,0.5) node {\large$\star$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
129 |
\draw (3.5,0.5) node {\large$\star$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
130 |
\end{tikzpicture}\\ |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
131 |
\end{center} |
44 | 132 |
|
133 |
\end{frame}} |
|
134 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
135 |
||
136 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
137 |
\mode<presentation>{ |
|
147
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
138 |
\begin{frame}<1-2>[c] |
44 | 139 |
|
147
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
140 |
\begin{center} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
141 |
\begin{tabular}{@{\hspace{-8mm}}cc@{}} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
142 |
\begin{tikzpicture}[>=stealth',very thick,auto, |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
143 |
every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},] |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
144 |
\node[state,initial] (q_0) {$q_0$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
145 |
\node[state] (q_1) [right=of q_0] {$q_1$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
146 |
\node[state] (q_2) [below right=of q_0] {$q_2$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
147 |
\node[state] (q_3) [right=of q_2] {$q_3$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
148 |
\node[state, accepting] (q_4) [right=of q_1] {$q_4$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
149 |
\path[->] (q_0) edge node [above] {\alert{$a$}} (q_1); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
150 |
\path[->] (q_1) edge node [above] {\alert{$a$}} (q_4); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
151 |
\path[->] (q_4) edge [loop right] node {\alert{$a, b$}} (); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
152 |
\path[->] (q_3) edge node [right] {\alert{$a$}} (q_4); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
153 |
\path[->] (q_2) edge node [above] {\alert{$a$}} (q_3); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
154 |
\path[->] (q_1) edge node [right] {\alert{$b$}} (q_2); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
155 |
\path[->] (q_0) edge node [above] {\alert{$b$}} (q_2); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
156 |
\path[->] (q_2) edge [loop left] node {\alert{$b$}} (); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
157 |
\path[->] (q_3) edge [bend left=95, looseness=1.3] node [below] {\alert{$b$}} (q_0); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
158 |
\end{tikzpicture} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
159 |
& |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
160 |
\raisebox{9mm}{\begin{tikzpicture}[scale=0.6,line width=0.8mm] |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
161 |
\draw (0,0) -- (4,0); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
162 |
\draw (0,1) -- (4,1); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
163 |
\draw (0,2) -- (3,2); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
164 |
\draw (0,3) -- (2,3); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
165 |
\draw (0,4) -- (1,4); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
166 |
|
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
167 |
\draw (0,0) -- (0, 4); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
168 |
\draw (1,0) -- (1, 4); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
169 |
\draw (2,0) -- (2, 3); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
170 |
\draw (3,0) -- (3, 2); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
171 |
\draw (4,0) -- (4, 1); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
172 |
|
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
173 |
\draw (0.5,-0.5) node {$q_0$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
174 |
\draw (1.5,-0.5) node {$q_1$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
175 |
\draw (2.5,-0.5) node {$q_2$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
176 |
\draw (3.5,-0.5) node {$q_3$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
177 |
|
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
178 |
\draw (-0.5, 3.5) node {$q_1$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
179 |
\draw (-0.5, 2.5) node {$q_2$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
180 |
\draw (-0.5, 1.5) node {$q_3$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
181 |
\draw (-0.5, 0.5) node {$q_4$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
182 |
|
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
183 |
\draw (0.5,0.5) node {\large$\star$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
184 |
\draw (1.5,0.5) node {\large$\star$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
185 |
\draw (2.5,0.5) node {\large$\star$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
186 |
\draw (3.5,0.5) node {\large$\star$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
187 |
\draw (0.5,1.5) node {\large$\star$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
188 |
\draw (2.5,1.5) node {\large$\star$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
189 |
\draw (0.5,3.5) node {\large$\star$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
190 |
\draw (1.5,2.5) node {\large$\star$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
191 |
\end{tikzpicture}} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
192 |
\end{tabular} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
193 |
\end{center} |
44 | 194 |
|
195 |
||
147
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
196 |
\mbox{}\\[-20mm]\mbox{} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
197 |
|
44 | 198 |
\begin{center} |
147
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
199 |
\begin{tikzpicture}[>=stealth',very thick,auto, |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
200 |
every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},] |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
201 |
\node[state,initial] (q_02) {$q_{0, 2}$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
202 |
\node[state] (q_13) [right=of q_02] {$q_{1, 3}$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
203 |
\node[state, accepting] (q_4) [right=of q_13] {$q_{4\phantom{,0}}$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
204 |
\path[->] (q_02) edge [bend left] node [above] {\alert{$a$}} (q_13); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
205 |
\path[->] (q_13) edge [bend left] node [below] {\alert{$b$}} (q_02); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
206 |
\path[->] (q_02) edge [loop below] node {\alert{$b$}} (); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
207 |
\path[->] (q_13) edge node [above] {\alert{$a$}} (q_4); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
208 |
\path[->] (q_4) edge [loop above] node {\alert{$a, b$}} (); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
209 |
\end{tikzpicture}\\ |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
210 |
minimal automaton |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
211 |
\end{center} |
44 | 212 |
|
213 |
\end{frame}} |
|
214 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
215 |
||
147
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
216 |
|
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
217 |
|
44 | 218 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
219 |
\mode<presentation>{ |
|
220 |
\begin{frame}[c] |
|
221 |
||
147
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
222 |
\begin{center} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
223 |
\begin{tikzpicture}[>=stealth',very thick,auto, |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
224 |
every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},] |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
225 |
\only<1>{\node[state,initial] (q_0) {$q_0$};} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
226 |
\only<2->{\node[state,accepting] (q_0) {$q_0$};} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
227 |
\node[state] (q_1) [right=of q_0] {$q_1$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
228 |
\node[state] (q_2) [below right=of q_0] {$q_2$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
229 |
\node[state] (q_3) [right=of q_2] {$q_3$}; |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
230 |
\only<1>{\node[state, accepting] (q_4) [right=of q_1] {$q_4$};} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
231 |
\only<2->{\node[state, initial right] (q_4) [right=of q_1] {$q_4$};} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
232 |
\only<1-2>{ |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
233 |
\path[->] (q_0) edge node [above] {\alert{$a$}} (q_1); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
234 |
\path[->] (q_1) edge node [above] {\alert{$a$}} (q_4); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
235 |
\path[->] (q_4) edge [loop above] node {\alert{$a, b$}} (); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
236 |
\path[->] (q_3) edge node [right] {\alert{$a$}} (q_4); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
237 |
\path[->] (q_2) edge node [above] {\alert{$a$}} (q_3); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
238 |
\path[->] (q_1) edge node [right] {\alert{$b$}} (q_2); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
239 |
\path[->] (q_0) edge node [above] {\alert{$b$}} (q_2); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
240 |
\path[->] (q_2) edge [loop left] node {\alert{$b$}} (); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
241 |
\path[->] (q_3) edge [bend left=95, looseness=1.3] node [below] {\alert{$b$}} (q_0);} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
242 |
\only<3->{ |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
243 |
\path[<-] (q_0) edge node [above] {\alert{$a$}} (q_1); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
244 |
\path[<-] (q_1) edge node [above] {\alert{$a$}} (q_4); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
245 |
\path[<-] (q_4) edge [loop above] node {\alert{$a, b$}} (); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
246 |
\path[<-] (q_3) edge node [right] {\alert{$a$}} (q_4); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
247 |
\path[<-] (q_2) edge node [above] {\alert{$a$}} (q_3); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
248 |
\path[<-] (q_1) edge node [right] {\alert{$b$}} (q_2); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
249 |
\path[<-] (q_0) edge node [above] {\alert{$b$}} (q_2); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
250 |
\path[<-] (q_2) edge [loop left] node {\alert{$b$}} (); |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
251 |
\path[<-] (q_3) edge [bend left=95, looseness=1.3] node [below] {\alert{$b$}} (q_0);} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
252 |
\end{tikzpicture} |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
253 |
\end{center} |
44 | 254 |
|
255 |
\begin{itemize} |
|
147
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
256 |
\item<2-> exchange initial / accepting states |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
257 |
\item<3-> reverse all edges |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
258 |
\item<4-> subset construction $\Rightarrow$ DFA |
4725bba8ef26
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
93
diff
changeset
|
259 |
\item<5-> repeat once more \onslide<6->{$\Rightarrow$ minimal DFA} |
44 | 260 |
|
261 |
\end{itemize} |
|
262 |
||
263 |
\end{frame}} |
|
264 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
265 |
||
266 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
267 |
\mode<presentation>{ |
|
268 |
\begin{frame}[c] |
|
269 |
||
153
70ab41cb610e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
151
diff
changeset
|
270 |
\mbox{\lstinputlisting[language=while]{../progs/fib.while}} |
44 | 271 |
|
272 |
\end{frame}} |
|
273 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
274 |
||
275 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
276 |
\mode<presentation>{ |
|
277 |
\begin{frame}[c] |
|
278 |
||
153
70ab41cb610e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
151
diff
changeset
|
279 |
\mbox{\lstinputlisting[language=while]{../progs/collatz.while}} |
44 | 280 |
|
281 |
\end{frame}} |
|
282 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
283 |
||
46 | 284 |
|
148
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
285 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
286 |
\mode<presentation>{ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
287 |
\begin{frame}[c] |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
288 |
|
157
b6eee9571a63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
153
diff
changeset
|
289 |
\mbox{\lstinputlisting[language=while]{../progs/collatz.while}} |
148
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
290 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
291 |
\begin{textblock}{6}(10,2) |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
292 |
\begin{tikzpicture}[scale=0.46] |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
293 |
\begin{axis}[axis x line=bottom, axis y line=left, ylabel=secs, |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
294 |
xlabel=n, |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
295 |
enlargelimits=0.05, |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
296 |
ybar interval=0.7, legend style=small] |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
297 |
\addplot file {interpreted2.data}; |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
298 |
\addplot file {compiled2.data}; |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
299 |
%\legend{interpreted, compiled} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
300 |
\end{axis} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
301 |
\end{tikzpicture} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
302 |
\end{textblock} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
303 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
304 |
\end{frame}} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
305 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
150
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
306 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
307 |
\mode<presentation>{ |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
308 |
\begin{frame}[c] |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
309 |
|
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
310 |
\begin{tikzpicture}[scale=1] |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
311 |
|
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
312 |
\draw[line width=1mm] (-.3, 0) rectangle (1.5,2); |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
313 |
\draw (4.2,1) node {Code Gen}; |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
314 |
\draw (0.6,1.7) node {\footnotesize Parser}; |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
315 |
\draw (-2.7,1.7) node {\footnotesize Lexer}; |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
316 |
|
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
317 |
\draw[line width=1mm] (-1.8, 0) rectangle (-3.6,2); |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
318 |
|
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
319 |
\draw[white] (1.7,1) node (X) {}; |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
320 |
\draw[white] (3.2,1) node (Y) {}; |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
321 |
\draw[red, ->, line width = 2mm] (X) -- (Y); |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
322 |
|
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
323 |
\draw[red, <-, line width = 2mm] (-0.6,1) -- (-1.6,1); |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
324 |
\draw[red, <-, line width = 2mm] (-3.8,1) -- (-4.8,1); |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
325 |
\end{tikzpicture} |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
326 |
|
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
327 |
|
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
328 |
\end{frame}} |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
329 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
148
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
330 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
331 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
332 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
333 |
\mode<presentation>{ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
334 |
\begin{frame}[t] |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
335 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
336 |
\consolas |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
337 |
\begin{center} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
338 |
"if true then then 42 else +" |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
339 |
\end{center} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
340 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
341 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
342 |
\begin{tabular}{@{}l} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
343 |
KEYWORD: \\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
344 |
\hspace{5mm}{if}, {then}, {else},\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
345 |
WHITESPACE:\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
346 |
\hspace{5mm}{" "}, {$\backslash$n},\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
347 |
IDENT:\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
348 |
\hspace{5mm}LETTER $\cdot$ (LETTER + DIGIT + {\_})$^*$\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
349 |
NUM:\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
350 |
\hspace{5mm}(NONZERODIGIT $\cdot$ DIGIT$^*$) + {0}\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
351 |
OP:\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
352 |
\hspace{5mm}{+}\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
353 |
COMMENT:\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
354 |
\hspace{5mm}{$\slash$*} $\cdot$ (ALL$^*$ $\cdot$ {*$\slash$} $\cdot$ ALL$^*$) $\cdot$ {*$\slash$} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
355 |
\end{tabular} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
356 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
357 |
\end{frame}} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
358 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
359 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
360 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
361 |
\mode<presentation>{ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
362 |
\begin{frame}[t] |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
363 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
364 |
\consolas |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
365 |
\begin{center} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
366 |
"if true then then 42 else +" |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
367 |
\end{center} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
368 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
369 |
\only<1>{ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
370 |
\small\begin{tabular}{l} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
371 |
KEYWORD(if),\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
372 |
WHITESPACE,\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
373 |
IDENT(true),\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
374 |
WHITESPACE,\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
375 |
KEYWORD(then),\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
376 |
WHITESPACE,\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
377 |
KEYWORD(then),\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
378 |
WHITESPACE,\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
379 |
NUM(42),\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
380 |
WHITESPACE,\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
381 |
KEYWORD(else),\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
382 |
WHITESPACE,\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
383 |
OP(+) |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
384 |
\end{tabular}} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
385 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
386 |
\only<2>{ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
387 |
\small\begin{tabular}{l} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
388 |
KEYWORD(if),\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
389 |
IDENT(true),\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
390 |
KEYWORD(then),\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
391 |
KEYWORD(then),\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
392 |
NUM(42),\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
393 |
KEYWORD(else),\\ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
394 |
OP(+) |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
395 |
\end{tabular}} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
396 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
397 |
\end{frame}} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
398 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
399 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
400 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
401 |
\mode<presentation>{ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
402 |
\begin{frame}[c] |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
403 |
|
150
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
404 |
|
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
405 |
There is one small problem with the tokenizer. How should we |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
406 |
tokenize: |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
407 |
|
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
408 |
\begin{center} |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
409 |
{\consolas "x - 3"} |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
410 |
\end{center} |
149
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
411 |
|
150
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
412 |
\consolas |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
413 |
\begin{tabular}{@{}l} |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
414 |
OP:\\ |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
415 |
\hspace{5mm}\texttt{"+"}, \texttt{"-"}\\ |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
416 |
NUM:\\ |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
417 |
\hspace{5mm}(NONZERODIGIT $\cdot$ DIGIT$^*$) + {''0''}\\ |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
418 |
NUMBER:\\ |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
419 |
\hspace{5mm}NUM + (\texttt{"-"} $\cdot$ NUM)\\ |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
420 |
\end{tabular} |
149
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
421 |
|
148
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
422 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
423 |
\end{frame}} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
424 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
425 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
426 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
427 |
\mode<presentation>{ |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
428 |
\begin{frame}[c] |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
429 |
\frametitle{\begin{tabular}{c}Two Rules\end{tabular}} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
430 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
431 |
\begin{itemize} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
432 |
\item Longest match rule (``maximal munch rule''): The |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
433 |
longest initial substring matched by any regular expression is taken |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
434 |
as next token.\bigskip |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
435 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
436 |
\item Rule priority: |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
437 |
For a particular longest initial substring, the first regular |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
438 |
expression that can match determines the token. |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
439 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
440 |
\end{itemize} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
441 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
442 |
%\url{http://www.technologyreview.com/tr10/?year=2011} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
443 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
444 |
%finite deterministic automata/ nondeterministic automaton |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
445 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
446 |
%\item problem with infix operations, for example i-12 |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
447 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
448 |
|
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
449 |
\end{frame}} |
36eb7bfb0e63
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
147
diff
changeset
|
450 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
149
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
451 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
452 |
\mode<presentation>{ |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
453 |
\begin{frame}[t] |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
454 |
\frametitle{\begin{tabular}{c}Nullable\end{tabular}} |
46 | 455 |
|
149
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
456 |
\small |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
457 |
\ldots{}whether a regular expression can match the empty string: |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
458 |
\begin{center} |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
459 |
\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}} |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
460 |
\bl{$nullable(\varnothing)$} & \bl{$\dn$} & \bl{$f\!\/alse$}\\ |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
461 |
\bl{$nullable(\epsilon)$} & \bl{$\dn$} & \bl{$true$}\\ |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
462 |
\bl{$nullable (c)$} & \bl{$\dn$} & \bl{$f\!alse$}\\ |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
463 |
\bl{$nullable (r_1 + r_2)$} & \bl{$\dn$} & \bl{$nullable(r_1) \vee nullable(r_2)$} \\ |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
464 |
\bl{$nullable (r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{$nullable(r_1) \wedge nullable(r_2)$} \\ |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
465 |
\bl{$nullable (r^*)$} & \bl{$\dn$} & \bl{$true$} \\ |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
466 |
\end{tabular} |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
467 |
\end{center} |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
468 |
|
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
469 |
\end{frame}} |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
470 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
471 |
|
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
472 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
473 |
\mode<presentation>{ |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
474 |
\begin{frame}[c] |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
475 |
\frametitle{\begin{tabular}{c}Zeroable\end{tabular}} |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
476 |
|
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
477 |
\small |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
478 |
\ldots{}whether a regular expression can match nothing: |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
479 |
\begin{center} |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
480 |
\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}} |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
481 |
\bl{$zeroable(\varnothing)$} & \bl{$\dn$} & \bl{$true$}\\ |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
482 |
\bl{$zeroable(\epsilon)$} & \bl{$\dn$} & \bl{$f\!alse$}\\ |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
483 |
\bl{$zeroable (c)$} & \bl{$\dn$} & \bl{$f\!alse$}\\ |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
484 |
\bl{$zeroable (r_1 + r_2)$} & \bl{$\dn$} & \bl{$zeroable(r_1) \wedge zeroable(r_2)$} \\ |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
485 |
\bl{$zeroable (r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{$zeroable(r_1) \vee zeroable(r_2)$} \\ |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
486 |
\bl{$zeroable (r^*)$} & \bl{$\dn$} & \bl{$f\!alse$} \\ |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
487 |
\end{tabular} |
150
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
488 |
\end{center}\bigskip\pause |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
489 |
|
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
490 |
\begin{center} |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
491 |
\bl{$zeroable(r) \Leftrightarrow L(r) = \varnothing$} |
149
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
492 |
\end{center} |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
493 |
|
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
494 |
\end{frame}} |
b728c9dbf120
add
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
148
diff
changeset
|
495 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
46 | 496 |
|
150
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
497 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
498 |
\mode<presentation>{ |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
499 |
\begin{frame}[c] |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
500 |
|
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
501 |
\begin{itemize} |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
502 |
\item The star-case in our proof about the matcher needs the following lemma |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
503 |
\begin{center} |
151
df229ec49b22
added ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
150
diff
changeset
|
504 |
\bl{$Der\,c\,A^* = (Der\,c\,A)\,@\, A^*$} |
150
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
505 |
\end{center} |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
506 |
\end{itemize}\bigskip\bigskip |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
507 |
|
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
508 |
\begin{itemize} |
151
df229ec49b22
added ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
150
diff
changeset
|
509 |
\item \bl{$A^* = \{""\} \cup A\,@\,A^*$} |
150
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
510 |
\item If \bl{\texttt{""} $\in A$}, then\\ \bl{$Der\,c\,(A @ B) = (Der\,c\,A) @ B \cup (Der\,c\,B)$}\medskip |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
511 |
\item If \bl{\texttt{""} $\not\in A$}, then\\ \bl{$Der\,c\,(A @ B) = (Der\,c\,A) @ B$} |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
512 |
|
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
513 |
\end{itemize} |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
514 |
|
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
515 |
\end{frame}} |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
516 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
517 |
|
a2d792ed768e
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
149
diff
changeset
|
518 |
|
44 | 519 |
\end{document} |
520 |
||
521 |
%%% Local Variables: |
|
522 |
%%% mode: latex |
|
523 |
%%% TeX-master: t |
|
524 |
%%% End: |
|
525 |