diff -r 5be68de225e9 -r 828303e8e4af slides/slides03.tex --- a/slides/slides03.tex Sat Nov 30 00:06:02 2013 +0000 +++ b/slides/slides03.tex Sun Dec 01 09:58:41 2013 +0000 @@ -1,8 +1,5 @@ \documentclass[dvipsnames,14pt,t]{beamer} \usepackage{beamerthemeplaincu} -%%\usepackage[T1]{fontenc} -\usepackage[latin1]{inputenc} -\usepackage{mathpartir} \usepackage[absolute,overlay]{textpos} \usepackage{ifthen} \usepackage{tikz} @@ -21,62 +18,14 @@ \usetikzlibrary{fit} \usetikzlibrary{backgrounds} \usepackage{graphicx} +\usepackage{../langs} +\usepackage{../data} -\definecolor{javared}{rgb}{0.6,0,0} % for strings -\definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments -\definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords -\definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc \makeatletter \lst@CCPutMacro\lst@ProcessOther {"2D}{\lst@ttfamily{-{}}{-{}}} \@empty\z@\@empty \makeatother -\lstset{language=Java, - basicstyle=\consolas, - keywordstyle=\color{javapurple}\bfseries, - stringstyle=\color{javagreen}, - commentstyle=\color{javagreen}, - morecomment=[s][\color{javadocblue}]{/**}{*/}, - numbers=left, - numberstyle=\tiny\color{black}, - stepnumber=1, - numbersep=10pt, - tabsize=2, - showspaces=false, - showstringspaces=false} - -\lstdefinelanguage{scala}{ - morekeywords={abstract,case,catch,class,def,% - do,else,extends,false,final,finally,% - for,if,implicit,import,match,mixin,% - new,null,object,override,package,% - private,protected,requires,return,sealed,% - super,this,throw,trait,true,try,% - type,val,var,while,with,yield}, - otherkeywords={=>,<-,<\%,<:,>:,\#,@,->}, - sensitive=true, - morecomment=[l]{//}, - morecomment=[n]{/*}{*/}, - morestring=[b]", - morestring=[b]', - morestring=[b]""" -} - -\lstset{language=Scala, - basicstyle=\consolas, - keywordstyle=\color{javapurple}\bfseries, - stringstyle=\color{javagreen}, - commentstyle=\color{javagreen}, - morecomment=[s][\color{javadocblue}]{/**}{*/}, - numbers=left, - numberstyle=\tiny\color{black}, - stepnumber=1, - numbersep=10pt, - tabsize=2, - showspaces=false, - showstringspaces=false} - - % beamer stuff \renewcommand{\slidecaption}{AFL 03, King's College London, 9.~October 2013} \newcommand{\bl}[1]{\textcolor{blue}{#1}} @@ -440,10 +389,11 @@ \begin{center} \begin{tikzpicture}[>=stealth',very thick,auto, every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},] -\node[state,initial] (q_0) {$q_0$}; \node[state] (q_1) [right=of q_0] {$q_1$}; +\node[state,initial] (q_0) {$q_0$}; +\node[state] (q_1) [right=of q_0] {$q_1$}; \node[state] (q_2) [below right=of q_0] {$q_2$}; \node[state] (q_3) [right=of q_2] {$q_3$}; -\node[state, accepting] (q_4) [right=of q_1] {$q_4$}; +\node[state, accepting] (q_4) [right=of q_1] {$q_4$}; \path[->] (q_0) edge node [above] {\alert{$a$}} (q_1); \path[->] (q_1) edge node [above] {\alert{$a$}} (q_4); \path[->] (q_4) edge [loop right] node {\alert{$a, b$}} (); @@ -473,10 +423,11 @@ \begin{center} \begin{tikzpicture}[>=stealth',very thick,auto, every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},] -\node[state,initial] (q_0) {$q_0$}; \node[state] (q_1) [right=of q_0] {$q_1$}; +\node[state,initial] (q_0) {$q_0$}; +\node[state] (q_1) [right=of q_0] {$q_1$}; \node[state] (q_2) [below right=of q_0] {$q_2$}; \node[state] (q_3) [right=of q_2] {$q_3$}; -\node[state, accepting] (q_4) [right=of q_1] {$q_4$}; +\node[state, accepting] (q_4) [right=of q_1] {$q_4$}; \path[->] (q_0) edge node [above] {\alert{$a$}} (q_1); \path[->] (q_1) edge node [above] {\alert{$a$}} (q_4); \path[->] (q_4) edge [loop right] node {\alert{$a, b$}} (); @@ -569,10 +520,14 @@ \begin{tabular}[t]{c@{\hspace{9mm}}c} \begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},] -\node[state,initial] (q_0) {$q_0$}; \node[state] (q_1) [above=of q_0] {$q_1$}; \node[state, accepting] (q_2) [below=of q_0] {$q_2$}; -\path[->] (q_0) edge node [left] {\alert{$\epsilon$}} (q_1); \path[->] (q_0) edge node [left] {\alert{$\epsilon$}} (q_2); -\path[->] (q_0) edge [loop right] node {\alert{$a$}} (); \path[->] (q_1) edge [loop above] node {\alert{$a$}} (); -\path[->] (q_2) edge [loop below] node {\alert{$b$}} (); +\node[state,initial] (q_0) {$q_0$}; +\node[state] (q_1) [above=of q_0] {$q_1$}; +\node[state, accepting] (q_2) [below=of q_0] {$q_2$}; +\path[->] (q_0) edge node [left] {\alert{$\epsilon$}} (q_1); +\path[->] (q_0) edge node [left] {\alert{$\epsilon$}} (q_2); +\path[->] (q_0) edge [loop right] node {\alert{$a$}} (); +\path[->] (q_1) edge [loop above] node {\alert{$a$}} (); +\path[->] (q_2) edge [loop below] node {\alert{$b$}} (); \end{tikzpicture} & \raisebox{20mm}{ @@ -602,15 +557,15 @@ \begin{tabular}[t]{l@{\hspace{10mm}}l} \raisebox{1mm}{\bl{$\varnothing$}} & \begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},] -\node[state, initial] (q_0) {$\mbox{}$}; +\node[state, initial] (q_0) {$\mbox{}$}; \end{tikzpicture}\\\\ \raisebox{1mm}{\bl{$\epsilon$}} & \begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},] -\node[state, initial, accepting] (q_0) {$\mbox{}$}; +\node[state, initial, accepting] (q_0) {$\mbox{}$}; \end{tikzpicture}\\\\ \raisebox{2mm}{\bl{$c$}} & \begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},] -\node[state, initial] (q_0) {$\mbox{}$}; +\node[state, initial] (q_0) {$\mbox{}$}; \node[state, accepting] (q_1) [right=of q_0] {$\mbox{}$}; \path[->] (q_0) edge node [below] {\alert{$c$}} (q_1); \end{tikzpicture}\\\\ @@ -768,10 +723,14 @@ \begin{center} \begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=0pt,draw=blue!50,very thick,fill=blue!20},] -\node[state,initial] (q_0) {$q_0$}; \node[state] (q_1) [above=of q_0] {$q_1$}; \node[state, accepting] (q_2) [below=of q_0] {$q_2$}; -\path[->] (q_0) edge node [left] {\alert{$\epsilon$}} (q_1); \path[->] (q_0) edge node [left] {\alert{$\epsilon$}} (q_2); -\path[->] (q_0) edge [loop right] node {\alert{$a$}} (); \path[->] (q_1) edge [loop above] node {\alert{$a$}} (); -\path[->] (q_2) edge [loop below] node {\alert{$b$}} (); +\node[state,initial] (q_0) {$q_0$}; +\node[state] (q_1) [above=of q_0] {$q_1$}; +\node[state, accepting] (q_2) [below=of q_0] {$q_2$}; +\path[->] (q_0) edge node [left] {\alert{$\epsilon$}} (q_1); +\path[->] (q_0) edge node [left] {\alert{$\epsilon$}} (q_2); +\path[->] (q_0) edge [loop right] node {\alert{$a$}} (); +\path[->] (q_1) edge [loop above] node {\alert{$a$}} (); +\path[->] (q_2) edge [loop below] node {\alert{$b$}} (); \end{tikzpicture} \end{center} \end{textblock} @@ -822,10 +781,11 @@ \begin{center} \begin{tikzpicture}[>=stealth',very thick,auto, every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},] -\node[state,initial] (q_0) {$q_0$}; \node[state] (q_1) [right=of q_0] {$q_1$}; +\node[state,initial] (q_0) {$q_0$}; +\node[state] (q_1) [right=of q_0] {$q_1$}; \node[state] (q_2) [below right=of q_0] {$q_2$}; \node[state] (q_3) [right=of q_2] {$q_3$}; -\node[state, accepting] (q_4) [right=of q_1] {$q_4$}; +\node[state, accepting] (q_4) [right=of q_1] {$q_4$}; \path[->] (q_0) edge node [above] {\alert{$a$}} (q_1); \path[->] (q_1) edge node [above] {\alert{$a$}} (q_4); \path[->] (q_4) edge [loop right] node {\alert{$a, b$}} (); @@ -843,8 +803,9 @@ \begin{center} \begin{tikzpicture}[>=stealth',very thick,auto, every state/.style={minimum size=0pt,inner sep=2pt,draw=blue!50,very thick,fill=blue!20},] -\node[state,initial] (q_02) {$q_{0, 2}$}; \node[state] (q_13) [right=of q_02] {$q_{1, 3}$}; -\node[state, accepting] (q_4) [right=of q_13] {$q_{4\phantom{,0}}$}; +\node[state,initial] (q_02) {$q_{0, 2}$}; +\node[state] (q_13) [right=of q_02] {$q_{1, 3}$}; +\node[state, accepting] (q_4) [right=of q_13] {$q_{4\phantom{,0}}$}; \path[->] (q_02) edge [bend left] node [above] {\alert{$a$}} (q_13); \path[->] (q_13) edge [bend left] node [below] {\alert{$b$}} (q_02); \path[->] (q_02) edge [loop below] node {\alert{$b$}} ();