--- a/progs/thompson.scala Tue Oct 17 13:49:45 2017 +0100
+++ b/progs/thompson.scala Wed Oct 18 08:36:44 2017 +0100
@@ -164,9 +164,9 @@
// while my thompson-enfa-subset-partial-function-chain
// is probably not the most effcient way to obtain a fast DFA
-// (the below should be much faster with a more direct construction),
-// in general the DFAs can be slow because of the state explosion
-// in the subset construction
+// (the test below should be much faster with a more direct
+// construction), in general the DFAs can be slow because of
+// the state explosion in the subset construction
for (i <- 1 to 13) {
println(i + ": " + "%.5f".format(time_needed(2, tmatches_dfa(EVIL1(i), "a" * i))))
--- a/progs/token.scala Tue Oct 17 13:49:45 2017 +0100
+++ b/progs/token.scala Wed Oct 18 08:36:44 2017 +0100
@@ -254,8 +254,8 @@
println(env(lexing_simp(WHILE_REGS, prog1)))
-// Big Test
-//==========
+// Bigger Test
+//=============
val prog2 = """
write "fib";
@@ -276,8 +276,10 @@
println(env(lexing_simp(WHILE_REGS, prog2)))
println(env(lexing_simp(WHILE_REGS, prog2)).filterNot{_._1 == "w"}.mkString("\n"))
-// some more timing tests
-for (i <- 1 to 101 by 10) {
+// some more timing tests with
+// i copies of the program
+
+for (i <- 1 to 21 by 10) {
print(i.toString + ": ")
time(lexing_simp(WHILE_REGS, prog2 * i))
}
Binary file slides/slides04.pdf has changed
--- a/slides/slides04.tex Tue Oct 17 13:49:45 2017 +0100
+++ b/slides/slides04.tex Wed Oct 18 08:36:44 2017 +0100
@@ -338,7 +338,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c]
-\frametitle{Lexing}
+\frametitle{Lexing: Test Case}
\mbox{\lstinputlisting[language=While]{../progs/fib.while}}
@@ -347,7 +347,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c]
-\frametitle{??}
+\frametitle{?? Test Case}
\mbox{\lstinputlisting[language=While]{../progs/collatz.while}}
@@ -368,12 +368,12 @@
\hspace{5mm}{if}, {then}, {else},\\
WHITESPACE:\\
\hspace{5mm}{" "}, {$\backslash$n},\\
-IDENT:\\
+IDENTIFIER:\\
\hspace{5mm}LETTER $\cdot$ (LETTER + DIGIT + {\_})$^*$\\
NUM:\\
\hspace{5mm}(NONZERODIGIT $\cdot$ DIGIT$^*$) + {0}\\
OP:\\
-\hspace{5mm}{+}\\
+\hspace{5mm}+, -, *, \%, <, <=\\
COMMENT:\\
\hspace{5mm}{$\slash$*} $\cdot$ $\sim$(ALL$^*$ $\cdot$ (*$\slash$) $\cdot$ ALL$^*$) $\cdot$ {*$\slash$}
\end{tabular}
@@ -510,7 +510,7 @@
\draw[->,line width=1mm] (r2) -- (r3) node[above,midway] {\bl{$der\,b$}};\pause
\node (r4) [right=of r3] {\bl{$r_4$}};
\draw[->,line width=1mm] (r3) -- (r4) node[above,midway] {\bl{$der\,c$}};\pause
-\draw (r4) node[anchor=west] {\;\raisebox{3mm}{\bl{$nullable$}}};\pause
+\draw (r4) node[anchor=west] {\;\raisebox{3mm}{\bl{$nullable?$}}};\pause
\node (v4) [below=of r4] {\bl{$v_4$}};
\draw[->,line width=1mm] (r4) -- (v4);\pause
\node (v3) [left=of v4] {\bl{$v_3$}};
@@ -586,12 +586,12 @@
\begin{center}
\begin{tabular}{lcl}
- \bl{$mkeps\,\ONE$} & \bl{$\dn$} & \bl{$Empty$}\\
- \bl{$mkeps\,r_1 + r_2$} & \bl{$\dn$} & \bl{if $nullable(r_1)$} \\
+ \bl{$mkeps\,(\ONE)$} & \bl{$\dn$} & \bl{$Empty$}\\
+ \bl{$mkeps\,(r_1 + r_2)$} & \bl{$\dn$} & \bl{if $nullable(r_1)$} \\
& & \bl{then $Left(mkeps(r_1))$}\\
& & \bl{else $Right(mkeps(r_2))$}\\
- \bl{$mkeps\,r_1 \cdot r_2$} & \bl{$\dn$} & \bl{$Seq(mkeps(r_1),mkeps(r_2))$}\\
- \bl{$mkeps\,r^*$} & \bl{$\dn$} & \bl{$[]$} \\
+ \bl{$mkeps\,(r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{$Seq(mkeps(r_1),mkeps(r_2))$}\\
+ \bl{$mkeps\,(r^*)$} & \bl{$\dn$} & \bl{$[]$} \\
\end{tabular}
\end{center}
@@ -602,10 +602,10 @@
\begin{frame}[c]
\frametitle{Inject}
-Injecting (``Adding'') a character to a value\\
+Injecting (``Adding'') a character to a value\\[-12mm]\mbox{}
\begin{center}
-\begin{tabular}{l@{\hspace{1mm}}c@{\hspace{1mm}}l}
+\begin{tabular}{@{}l@{\hspace{1mm}}c@{\hspace{1mm}}l@{}}
\bl{$inj\,(c)\,c\,Empty$} & \bl{$\dn$} & \bl{$Char\,c$}\\
\bl{$inj\,(r_1 + r_2)\,c\,Left(v)$} & \bl{$\dn$} & \bl{$Left(inj\,r_1\,c\,v)$}\\
\bl{$inj\,(r_1 + r_2)\,c\,Right(v)$} & \bl{$\dn$} & \bl{$Right(inj\,r_2\,c\,v)$}\\
@@ -1253,7 +1253,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c]
-\frametitle{Two Rules}
+\frametitle{Lexer: Two Rules}
\begin{itemize}
\item Longest match rule (``maximal munch rule''): The