added slides
authorChristian Urban <christian dot urban at kcl dot ac dot uk>
Wed, 30 Oct 2013 03:44:40 +0000
changeset 170 fa187fa5b642
parent 169 57df3d7b4a25
child 171 8db273a410cc
added slides
progs/app8.scala
slides/slides06.pdf
slides/slides06.tex
--- a/progs/app8.scala	Wed Oct 30 03:36:10 2013 +0000
+++ b/progs/app8.scala	Wed Oct 30 03:44:40 2013 +0000
@@ -1,3 +1,9 @@
+class AltParser[I, T](p: => Parser[I, T], 
+                      q: => Parser[I, T]) 
+                          extends Parser[I, T] {
+  def parse(sb: I) = p.parse(sb) ++ q.parse(sb)   
+}
+
 class SeqParser[I, T, S](p: => Parser[I, T], 
                          q: => Parser[I, S]) 
                              extends Parser[I, (T, S)] {
@@ -7,14 +13,8 @@
             yield ((head1, head2), tail2)
 }
 
-class AltParser[I, T](p: => Parser[I, T], 
-                      q: => Parser[I, T]) 
-                          extends Parser[I, T] {
-  def parse(sb: I) = p.parse(sb) ++ q.parse(sb)   
-}
-
 class FunParser[I, T, S](p: => Parser[I, T], f: T => S) 
-  extends Parser[I, S] {
+                                  extends Parser[I, S] {
   def parse(sb: I) = 
     for ((head, tail) <- p.parse(sb)) 
       yield (f(head), tail)
Binary file slides/slides06.pdf has changed
--- a/slides/slides06.tex	Wed Oct 30 03:36:10 2013 +0000
+++ b/slides/slides06.tex	Wed Oct 30 03:44:40 2013 +0000
@@ -152,6 +152,21 @@
 
 \end{frame}}
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\mode<presentation>{
+\begin{frame}[c]
+\frametitle{\begin{tabular}{c}Regular Languages\end{tabular}}
+
+While regular expressions are very useful for lexing, 
+there is no regular expression that can recognise the language \bl{$a^nb^n$}.\bigskip
+
+\begin{center}
+\bl{$(((()()))())$} \;\;vs.\;\; \bl{$(((()()))()))$}
+\end{center}
+
+
+\end{frame}}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 
 
 \newcommand{\qq}{\mbox{\texttt{"}}}
@@ -649,7 +664,7 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \mode<presentation>{
 \begin{frame}[c]
-\frametitle{Abstract Parsers}
+\frametitle{Abstract Parser Class}
 
 \mbox{\lstset{language=Scala}\fontsize{10}{12}\selectfont
 \texttt{\lstinputlisting{../progs/app7.scala}}}