slides04.tex
author Christian Urban <urbanc@in.tum.de>
Wed, 17 Oct 2012 00:58:06 +0100
changeset 35 487b0c0aef75
parent 34 eeff9953a1c1
child 36 6958606b886c
permissions -rw-r--r--
tuned
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
\documentclass[dvipsnames,14pt,t]{beamer}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
\usepackage{beamerthemeplainculight}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
\usepackage[T1]{fontenc}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
\usepackage[latin1]{inputenc}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
\usepackage{mathpartir}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
\usepackage[absolute,overlay]{textpos}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
\usepackage{ifthen}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
\usepackage{tikz}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
\usepackage{pgf}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
\usepackage{calc} 
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
\usepackage{ulem}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
\usepackage{courier}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
\usepackage{listings}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
\renewcommand{\uline}[1]{#1}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
\usetikzlibrary{arrows}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
\usetikzlibrary{automata}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
\usetikzlibrary{shapes}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
\usetikzlibrary{shadows}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
\usetikzlibrary{positioning}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
\usetikzlibrary{calc}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
\usepackage{graphicx} 
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
\definecolor{javared}{rgb}{0.6,0,0} % for strings
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
\definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
\definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
\definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
\lstset{language=Java,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
	basicstyle=\ttfamily,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
	keywordstyle=\color{javapurple}\bfseries,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
	stringstyle=\color{javagreen},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
	commentstyle=\color{javagreen},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
	morecomment=[s][\color{javadocblue}]{/**}{*/},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
	numbers=left,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
	numberstyle=\tiny\color{black},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
	stepnumber=1,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
	numbersep=10pt,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
	tabsize=2,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
	showspaces=false,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
	showstringspaces=false}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
\lstdefinelanguage{scala}{
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
  morekeywords={abstract,case,catch,class,def,%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
    do,else,extends,false,final,finally,%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
    for,if,implicit,import,match,mixin,%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
    new,null,object,override,package,%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
    private,protected,requires,return,sealed,%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
    super,this,throw,trait,true,try,%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
    type,val,var,while,with,yield},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
  otherkeywords={=>,<-,<\%,<:,>:,\#,@},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
  sensitive=true,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
  morecomment=[l]{//},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
  morecomment=[n]{/*}{*/},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
  morestring=[b]",
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
  morestring=[b]',
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
  morestring=[b]"""
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
\lstset{language=Scala,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
	basicstyle=\ttfamily,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
	keywordstyle=\color{javapurple}\bfseries,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
	stringstyle=\color{javagreen},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
	commentstyle=\color{javagreen},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
	morecomment=[s][\color{javadocblue}]{/**}{*/},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
	numbers=left,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
	numberstyle=\tiny\color{black},
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
	stepnumber=1,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
	numbersep=10pt,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
	tabsize=2,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
	showspaces=false,
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
	showstringspaces=false}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
% beamer stuff 
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
\renewcommand{\slidecaption}{AFL 04, King's College London, 17.~October 2012}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
\newcommand{\bl}[1]{\textcolor{blue}{#1}}       
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
\newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% for definitions
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
\begin{document}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
\mode<presentation>{
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
\begin{frame}<1>[t]
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
\frametitle{%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
  \begin{tabular}{@ {}c@ {}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
  \\[-3mm]
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    86
  \LARGE Automata and \\[-2mm] 
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
  \LARGE Formal Languages (4)\\[3mm] 
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
  \end{tabular}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
  \normalsize
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
  \begin{center}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
  \begin{tabular}{ll}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
  Email:  & christian.urban at kcl.ac.uk\\
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
  Of$\!$fice: & S1.27 (1st floor Strand Building)\\
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
  Slides: & KEATS (also home work is there)\\
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
  \end{tabular}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
  \end{center}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
\end{frame}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   104
\mode<presentation>{
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
\begin{frame}[c]
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   106
\frametitle{\begin{tabular}{c}Last Week\end{tabular}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   108
Last week I showed you\bigskip
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
\begin{itemize}
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   111
\item a tokenizer taking a list of regular expressions\bigskip
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
\item tokenization identifies lexeme in an input stream of characters (or string)
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   114
and cathegorizes  them into tokens
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   115
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   116
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   117
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   118
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   119
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   120
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   121
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   122
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   123
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   124
\frametitle{\begin{tabular}{c}Two Rules\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   125
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   126
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   127
\item Longest match rule (maximal munch rule): The 
34
Christian Urban <urbanc@in.tum.de>
parents: 33
diff changeset
   128
longest initial substring matched by any regular expression is taken
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   129
as next token.\bigskip
34
Christian Urban <urbanc@in.tum.de>
parents: 33
diff changeset
   130
Christian Urban <urbanc@in.tum.de>
parents: 33
diff changeset
   131
\item Rule priority:
Christian Urban <urbanc@in.tum.de>
parents: 33
diff changeset
   132
For a particular longest initial substring, the first regular
Christian Urban <urbanc@in.tum.de>
parents: 33
diff changeset
   133
expression that can match determines the token.
Christian Urban <urbanc@in.tum.de>
parents: 33
diff changeset
   134
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   135
\end{itemize}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   136
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   137
%\url{http://www.technologyreview.com/tr10/?year=2011}
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
  
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   139
%finite deterministic automata/ nondeterministic automaton
34
Christian Urban <urbanc@in.tum.de>
parents: 33
diff changeset
   140
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   141
%\item problem with infix operations, for example i-12
34
Christian Urban <urbanc@in.tum.de>
parents: 33
diff changeset
   142
Christian Urban <urbanc@in.tum.de>
parents: 33
diff changeset
   143
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   144
\end{frame}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   145
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   146
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   148
\mode<presentation>{
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   149
\begin{frame}[t]
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
\begin{center}
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   152
\texttt{"if true then then 42 else +"}
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   153
\end{center}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   155
\only<1>{
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   156
\small\begin{tabular}{l}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   157
KEYWORD(if),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   158
WHITESPACE,\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   159
IDENT(true),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   160
WHITESPACE,\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   161
KEYWORD(then),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   162
WHITESPACE,\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   163
KEYWORD(then),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   164
WHITESPACE,\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   165
NUM(42),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   166
WHITESPACE,\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   167
KEYWORD(else),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   168
WHITESPACE,\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   169
OP(+)
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   170
\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   171
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   172
\only<2>{
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   173
\small\begin{tabular}{l}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   174
KEYWORD(if),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   175
IDENT(true),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   176
KEYWORD(then),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   177
KEYWORD(then),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   178
NUM(42),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   179
KEYWORD(else),\\ 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   180
OP(+)
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   181
\end{tabular}}
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   182
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   183
\end{frame}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   184
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   185
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   186
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   187
\mode<presentation>{
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   188
\begin{frame}[c]
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   189
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   190
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   191
There is one small problem with the tokenizer. How should we 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   192
tokenize:
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   193
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   194
\begin{center}
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   195
\texttt{"x - 3"}
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   196
\end{center}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   197
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   198
\end{frame}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   199
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   200
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   201
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   202
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   203
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   204
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   205
\mode<presentation>{
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   206
\begin{frame}[c]
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   207
\frametitle{\begin{tabular}{c}Automata\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   208
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   209
A deterministic finite automaton consists of:
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   210
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   211
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   212
\item a finite set of states
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   213
\item one of these states is the start state
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   214
\item some states are accepting states, and
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   215
\item there is transition function\medskip 
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   216
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   217
\small
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   218
which takes a state and a character as arguments and produces a new state\smallskip\\
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   219
this function might not always be defined everywhere
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   220
\end{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   221
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   222
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   223
\bl{$A(Q, q_0, F, \delta)$}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   224
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   225
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   226
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   227
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   228
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   229
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   230
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   231
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   232
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   233
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   234
\includegraphics[scale=0.7]{pics/ch3.jpg}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   235
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   236
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   237
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   238
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   239
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   240
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   241
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   242
\begin{frame}[t]
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   243
\frametitle{\begin{tabular}{c}Accepting a String\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   244
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   245
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   246
\bl{$A(Q, q_0, F, \delta)$}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   247
\end{center}\bigskip
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   248
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   249
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   250
\begin{tabular}{l}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   251
\bl{$\hat{\delta}(\texttt{""}, q) = q$}\\
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   252
\bl{$\hat{\delta}(c::s, q) = \hat{\delta}(s, \delta(c, q))$}\\
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   253
\end{tabular}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   254
\end{center}\bigskip\pause
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   255
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   256
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   257
Accepting? \hspace{5mm}\bl{$\hat{\delta}(s, q_0) \in F$}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   258
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   259
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   260
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   261
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   262
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   263
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   264
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   265
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   266
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   267
\includegraphics[scale=0.7]{pics/ch4.jpg}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   268
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   269
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   270
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   271
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   272
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   273
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   274
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   275
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   276
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   277
\frametitle{\begin{tabular}{c}Languages\end{tabular}}
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   278
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   279
A language is \alert{regular} iff there exists
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   280
a regular expression that recognises all its strings.\bigskip\bigskip\pause
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   281
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   282
\textcolor{gray}{not all languages are regular, e.g.~\bl{a$^n$b$^n$}.}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   283
\end{frame}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   284
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   285
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   286
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   287
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   288
\mode<presentation>{
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   289
\begin{frame}[c]
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   290
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   291
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   292
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   293
\begin{itemize}
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   294
\item Assuming you have the alphabet \bl{\{a, b, c\}}\bigskip
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   295
\item Give a regular expression that can recognise all strings that have at least one \bl{b}.
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   296
\end{itemize}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   297
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   298
\end{frame}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   299
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   300
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   301
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   302
\mode<presentation>{
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   303
\begin{frame}[c]
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   304
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   305
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   306
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   307
\begin{itemize}
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   308
\item The star-case in our proof needs the following lemma
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   309
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   310
\bl{Der\,c\,A$^*$ $=$ (Der c A)\,@\, A$^*$}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   311
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   312
\end{itemize}\bigskip\bigskip
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   313
35
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   314
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   315
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   316
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   317
\item If \bl{\texttt{""} $\in$ A}, then\\ \bl{Der\,c\,(A @ B) $=$ (Der\,c\,A) @ B $\cup$ (Der\,c\,B)}\medskip
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   318
\item If \bl{\texttt{""} $\not\in$ A}, then\\ \bl{Der\,c\,(A @ B) $=$ (Der\,c\,A) @ B}
Christian Urban <urbanc@in.tum.de>
parents: 34
diff changeset
   319
33
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   320
\end{itemize}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   321
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   322
\end{frame}}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   323
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   324
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   325
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   326
\end{document}
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   327
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   328
%%% Local Variables:  
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   329
%%% mode: latex
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   330
%%% TeX-master: t
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   331
%%% End: 
92b3e287d87e slides 4
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   332