slides/slides05.tex
changeset 148 36eb7bfb0e63
parent 147 4725bba8ef26
child 149 b728c9dbf120
equal deleted inserted replaced
147:4725bba8ef26 148:36eb7bfb0e63
    17 \usetikzlibrary{shapes}
    17 \usetikzlibrary{shapes}
    18 \usetikzlibrary{shadows}
    18 \usetikzlibrary{shadows}
    19 \usetikzlibrary{positioning}
    19 \usetikzlibrary{positioning}
    20 \usetikzlibrary{calc}
    20 \usetikzlibrary{calc}
    21 \usepackage{graphicx} 
    21 \usepackage{graphicx} 
       
    22 \usepackage{pgfplots}
    22 
    23 
    23 \definecolor{javared}{rgb}{0.6,0,0} % for strings
    24 \definecolor{javared}{rgb}{0.6,0,0} % for strings
    24 \definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments
    25 \definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments
    25 \definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords
    26 \definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords
    26 \definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc
    27 \definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc
    73 	numbersep=10pt,
    74 	numbersep=10pt,
    74 	tabsize=2,
    75 	tabsize=2,
    75 	showspaces=false,
    76 	showspaces=false,
    76 	showstringspaces=false}
    77 	showstringspaces=false}
    77 	
    78 	
       
    79 \begin{filecontents}{interpreted2.data}
       
    80 %1 0.00503
       
    81 200 1.005863
       
    82 400 7.8296765
       
    83 600 27.2321885
       
    84 800 65.249271
       
    85 1000 135.4493445
       
    86 1200 232.134097
       
    87 1400 382.527227
       
    88 \end{filecontents}
       
    89 
       
    90 \begin{filecontents}{compiled2.data}
       
    91 200 0.222058
       
    92 400 0.215204
       
    93 600 0.202031
       
    94 800 0.21986
       
    95 1000 0.205934
       
    96 1200 0.1981615
       
    97 1400 0.207116
       
    98 \end{filecontents}
    78 
    99 
    79 % beamer stuff 
   100 % beamer stuff 
    80 \renewcommand{\slidecaption}{AFL 05, King's College London, 23.~October 2013}
   101 \renewcommand{\slidecaption}{AFL 05, King's College London, 23.~October 2013}
    81 \newcommand{\bl}[1]{\textcolor{blue}{#1}}       
   102 \newcommand{\bl}[1]{\textcolor{blue}{#1}}       
    82 \newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% for definitions
   103 \newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% for definitions
   334 
   355 
   335 \end{frame}}
   356 \end{frame}}
   336 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   357 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   337 
   358 
   338 
   359 
       
   360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   361 \mode<presentation>{
       
   362 \begin{frame}[c]
       
   363 
       
   364 \texttt{\consolas\lstinputlisting{../progs/loops.while}}
       
   365 
       
   366 \begin{textblock}{6}(10,2)
       
   367 \begin{tikzpicture}[scale=0.46]
       
   368 \begin{axis}[axis x line=bottom, axis y line=left, ylabel=secs,
       
   369     xlabel=n,
       
   370     enlargelimits=0.05,
       
   371     ybar interval=0.7, legend style=small]
       
   372 \addplot file {interpreted2.data};
       
   373 \addplot file {compiled2.data};
       
   374 %\legend{interpreted, compiled}
       
   375 \end{axis}
       
   376 \end{tikzpicture}
       
   377 \end{textblock}
       
   378 
       
   379 \end{frame}}
       
   380 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   381 
       
   382 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   383 
       
   384 \mode<presentation>{
       
   385 \begin{frame}[t]
       
   386 
       
   387 \consolas
       
   388 \begin{center}
       
   389 "if true then then 42 else +"
       
   390 \end{center}
       
   391 
       
   392 
       
   393 \begin{tabular}{@{}l}
       
   394 KEYWORD: \\
       
   395 \hspace{5mm}{if}, {then}, {else},\\ 
       
   396 WHITESPACE:\\
       
   397 \hspace{5mm}{" "}, {$\backslash$n},\\ 
       
   398 IDENT:\\
       
   399 \hspace{5mm}LETTER $\cdot$ (LETTER + DIGIT + {\_})$^*$\\ 
       
   400 NUM:\\
       
   401 \hspace{5mm}(NONZERODIGIT $\cdot$ DIGIT$^*$) + {0}\\
       
   402 OP:\\
       
   403 \hspace{5mm}{+}\\
       
   404 COMMENT:\\
       
   405 \hspace{5mm}{$\slash$*} $\cdot$ (ALL$^*$ $\cdot$ {*$\slash$} $\cdot$ ALL$^*$) $\cdot$ {*$\slash$}
       
   406 \end{tabular}
       
   407 
       
   408 \end{frame}}
       
   409 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   410 
       
   411 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   412 \mode<presentation>{
       
   413 \begin{frame}[t]
       
   414 
       
   415 \consolas
       
   416 \begin{center}
       
   417 "if true then then 42 else +"
       
   418 \end{center}
       
   419 
       
   420 \only<1>{
       
   421 \small\begin{tabular}{l}
       
   422 KEYWORD(if),\\ 
       
   423 WHITESPACE,\\ 
       
   424 IDENT(true),\\ 
       
   425 WHITESPACE,\\ 
       
   426 KEYWORD(then),\\ 
       
   427 WHITESPACE,\\ 
       
   428 KEYWORD(then),\\ 
       
   429 WHITESPACE,\\ 
       
   430 NUM(42),\\ 
       
   431 WHITESPACE,\\ 
       
   432 KEYWORD(else),\\ 
       
   433 WHITESPACE,\\ 
       
   434 OP(+)
       
   435 \end{tabular}}
       
   436 
       
   437 \only<2>{
       
   438 \small\begin{tabular}{l}
       
   439 KEYWORD(if),\\ 
       
   440 IDENT(true),\\ 
       
   441 KEYWORD(then),\\ 
       
   442 KEYWORD(then),\\ 
       
   443 NUM(42),\\ 
       
   444 KEYWORD(else),\\ 
       
   445 OP(+)
       
   446 \end{tabular}}
       
   447 
       
   448 \end{frame}}
       
   449 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
       
   450 
       
   451 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   452 \mode<presentation>{
       
   453 \begin{frame}[c]
       
   454 
       
   455 
       
   456 \end{frame}}
       
   457 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
       
   458 
       
   459 
       
   460 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   461 \mode<presentation>{
       
   462 \begin{frame}[c]
       
   463 \frametitle{\begin{tabular}{c}Two Rules\end{tabular}}
       
   464 
       
   465 \begin{itemize}
       
   466 \item Longest match rule (``maximal munch rule''): The 
       
   467 longest initial substring matched by any regular expression is taken
       
   468 as next token.\bigskip
       
   469 
       
   470 \item Rule priority:
       
   471 For a particular longest initial substring, the first regular
       
   472 expression that can match determines the token.
       
   473 
       
   474 \end{itemize}
       
   475 
       
   476 %\url{http://www.technologyreview.com/tr10/?year=2011}
       
   477   
       
   478 %finite deterministic automata/ nondeterministic automaton
       
   479 
       
   480 %\item problem with infix operations, for example i-12
       
   481 
       
   482 
       
   483 \end{frame}}
       
   484 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
   339 
   485 
   340 
   486 
   341 \newcommand{\qq}{\mbox{\texttt{"}}}
   487 \newcommand{\qq}{\mbox{\texttt{"}}}
   342 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   488 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   343 \mode<presentation>{
   489 \mode<presentation>{