# HG changeset patch # User Christian Urban # Date 1603930292 0 # Node ID c6f9752661554f44080612635a89faec155e3d7f # Parent ff2894dfc3992e28ec3b00577d73d12da962defe updated diff -r ff2894dfc399 -r c6f975266155 slides/slides05.pdf Binary file slides/slides05.pdf has changed diff -r ff2894dfc399 -r c6f975266155 slides/slides05.tex --- a/slides/slides05.tex Wed Oct 28 16:56:28 2020 +0000 +++ b/slides/slides05.tex Thu Oct 29 00:11:32 2020 +0000 @@ -16,6 +16,12 @@ % beamer stuff \renewcommand{\slidecaption}{CFL 05, King's College London} +\usepackage{tcolorbox} +\newtcolorbox{mybox}{colback=red!5!white,colframe=red!75!black} +\newtcolorbox{mybox2}[1]{colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries,title=#1} +\newtcolorbox{mybox3}[1]{colback=Cyan!5!white,colframe=Cyan!75!black,fonttitle=\bfseries,title=#1} + + \begin{document} @@ -347,30 +353,7 @@ \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\begin{frame}[c] -\frametitle{Context Sensitive Grammars} - -It is much harder to find out whether a string is parsed -by a context sensitive grammar: - -\bl{\begin{plstx}[margin=2cm] -: \meta{S} ::= b\meta{S}\meta{A}\meta{A} | \epsilon\\ -: \meta{A} ::= a\\ -: b\meta{A} ::= \meta{A}b\\ -\end{plstx}}\pause - -\begin{center} -\bl{$\meta{S} \rightarrow\ldots\rightarrow^? ababaa$} -\end{center}\pause - -\begin{center} - \tt Time flies like an arrow;\\ - fruit flies like bananas. - \end{center} - -\end{frame} -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame}[c] @@ -432,28 +415,6 @@ \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\begin{tikzpicture}[level distance=8mm, blue] - \node {$\meta{E}$} - child {node {$\meta{T}$} - child {node {$\meta{T}$} - child {node {(\,$\meta{E}$\,)} - child {node{$\meta{F}$ *{} $\meta{F}$} - child {node {$\meta{T}$} child {node {2}}} - child {node {$\meta{T}$} child {node {3}}} - } - } - } - child {node {+}} - child {node {$\meta{T}$} - child {node {(\,$\meta{E}$\,)} - child {node {$\meta{F}$} - child {node {$\meta{T}$ +{} $\meta{T}$} - child {node {3}} - child {node {4}} - } - }} - }}; -\end{tikzpicture} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame}[t] @@ -480,7 +441,7 @@ A grammar is \alert{\bf ambiguous} if there is a string that has at least two different parse trees. -\bl{\begin{plstx}[margin=3cm,one per line]: \meta{E} ::= num\_token +\bl{\begin{plstx}[margin=3cm,one per line]: \meta{E} ::= 0 ... 9 | \meta{E} \cdot + \cdot \meta{E} | \meta{E} \cdot - \cdot \meta{E} | \meta{E} \cdot * \cdot \meta{E} @@ -514,6 +475,32 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame}[c] +\frametitle{Context Sensitive Grammars} + +It is much harder to find out whether a string is parsed +by a context sensitive grammar: + +\bl{\begin{plstx}[margin=2cm] +: \meta{S} ::= b\meta{S}\meta{A}\meta{A} | \epsilon\\ +: \meta{A} ::= a\\ +: b\meta{A} ::= \meta{A}b\\ +\end{plstx}}\pause + +\begin{center} +\bl{$\meta{S} \rightarrow\ldots\rightarrow^? ababaa$} +\end{center}\pause + +\begin{center} + \tt Time flies like an arrow;\\ + fruit flies like bananas. + \end{center} + +\end{frame} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{frame}[c] \frametitle{Parser Combinators} One of the simplest ways to implement a parser, see @@ -932,6 +919,19 @@ \end{frame}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{frame}[t] +\begin{mybox3}{} + val (r1s, f1s) = simp(r1)\\ + val (r2s, f2s) = simp(r2)\\ + how are the + first rectification functions f1s and f2s made? could you maybe + show an example? +\end{mybox3} +\end{frame} + +\begin{frame}<1-12>[c] +\end{frame} + \end{document}