diff -r 4725bba8ef26 -r 36eb7bfb0e63 slides/slides05.tex --- a/slides/slides05.tex Tue Oct 22 23:17:53 2013 +0100 +++ b/slides/slides05.tex Wed Oct 23 00:09:41 2013 +0100 @@ -19,6 +19,7 @@ \usetikzlibrary{positioning} \usetikzlibrary{calc} \usepackage{graphicx} +\usepackage{pgfplots} \definecolor{javared}{rgb}{0.6,0,0} % for strings \definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments @@ -75,6 +76,26 @@ showspaces=false, showstringspaces=false} +\begin{filecontents}{interpreted2.data} +%1 0.00503 +200 1.005863 +400 7.8296765 +600 27.2321885 +800 65.249271 +1000 135.4493445 +1200 232.134097 +1400 382.527227 +\end{filecontents} + +\begin{filecontents}{compiled2.data} +200 0.222058 +400 0.215204 +600 0.202031 +800 0.21986 +1000 0.205934 +1200 0.1981615 +1400 0.207116 +\end{filecontents} % beamer stuff \renewcommand{\slidecaption}{AFL 05, King's College London, 23.~October 2013} @@ -336,6 +357,131 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\mode{ +\begin{frame}[c] + +\texttt{\consolas\lstinputlisting{../progs/loops.while}} + +\begin{textblock}{6}(10,2) +\begin{tikzpicture}[scale=0.46] +\begin{axis}[axis x line=bottom, axis y line=left, ylabel=secs, + xlabel=n, + enlargelimits=0.05, + ybar interval=0.7, legend style=small] +\addplot file {interpreted2.data}; +\addplot file {compiled2.data}; +%\legend{interpreted, compiled} +\end{axis} +\end{tikzpicture} +\end{textblock} + +\end{frame}} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\mode{ +\begin{frame}[t] + +\consolas +\begin{center} +"if true then then 42 else +" +\end{center} + + +\begin{tabular}{@{}l} +KEYWORD: \\ +\hspace{5mm}{if}, {then}, {else},\\ +WHITESPACE:\\ +\hspace{5mm}{" "}, {$\backslash$n},\\ +IDENT:\\ +\hspace{5mm}LETTER $\cdot$ (LETTER + DIGIT + {\_})$^*$\\ +NUM:\\ +\hspace{5mm}(NONZERODIGIT $\cdot$ DIGIT$^*$) + {0}\\ +OP:\\ +\hspace{5mm}{+}\\ +COMMENT:\\ +\hspace{5mm}{$\slash$*} $\cdot$ (ALL$^*$ $\cdot$ {*$\slash$} $\cdot$ ALL$^*$) $\cdot$ {*$\slash$} +\end{tabular} + +\end{frame}} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\mode{ +\begin{frame}[t] + +\consolas +\begin{center} +"if true then then 42 else +" +\end{center} + +\only<1>{ +\small\begin{tabular}{l} +KEYWORD(if),\\ +WHITESPACE,\\ +IDENT(true),\\ +WHITESPACE,\\ +KEYWORD(then),\\ +WHITESPACE,\\ +KEYWORD(then),\\ +WHITESPACE,\\ +NUM(42),\\ +WHITESPACE,\\ +KEYWORD(else),\\ +WHITESPACE,\\ +OP(+) +\end{tabular}} + +\only<2>{ +\small\begin{tabular}{l} +KEYWORD(if),\\ +IDENT(true),\\ +KEYWORD(then),\\ +KEYWORD(then),\\ +NUM(42),\\ +KEYWORD(else),\\ +OP(+) +\end{tabular}} + +\end{frame}} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\mode{ +\begin{frame}[c] + + +\end{frame}} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\mode{ +\begin{frame}[c] +\frametitle{\begin{tabular}{c}Two Rules\end{tabular}} + +\begin{itemize} +\item Longest match rule (``maximal munch rule''): The +longest initial substring matched by any regular expression is taken +as next token.\bigskip + +\item Rule priority: +For a particular longest initial substring, the first regular +expression that can match determines the token. + +\end{itemize} + +%\url{http://www.technologyreview.com/tr10/?year=2011} + +%finite deterministic automata/ nondeterministic automaton + +%\item problem with infix operations, for example i-12 + + +\end{frame}} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\qq}{\mbox{\texttt{"}}}