Binary file handouts/ho01.pdf has changed
--- a/handouts/ho01.tex Mon Aug 17 17:42:37 2020 +0100
+++ b/handouts/ho01.tex Sun Aug 23 23:44:44 2020 +0100
@@ -52,7 +52,7 @@
compiler is an old craft going back to 1952 with the first compiler
written by Grace Hopper.\footnote{Who many years ago was invited on a
talk show hosted by David Letterman.
-\here{https://youtu.be/3N_ywhx6_K0?t=31}.} Why studying compilers
+\here{https://youtu.be/3N_ywhx6_K0?t=31}} Why studying compilers
nowadays? An interesting answer is given by John Regher in his compiler
blog:\here{http://blog.regehr.org/archives/1419}
Binary file pics/777.png has changed
Binary file pics/llvmlogo.png has changed
--- a/progs/catastrophic/catastrophic.js Mon Aug 17 17:42:37 2020 +0100
+++ b/progs/catastrophic/catastrophic.js Sun Aug 23 23:44:44 2020 +0100
@@ -1,5 +1,4 @@
-
-
+#!/usr/local/bin/node
// A case of catastrophic backtracking in JavaScript/Node.js
//
@@ -8,11 +7,11 @@
//
// call with:
//
-// $> node catastrophic.js 20
+// $> catastrophic.js 20
//
// call with timing as:
//
-// $> time node catastrophic.js 25
+// $> time catastrophic.js 25
const args = process.argv[2]
--- a/progs/catastrophic/catastrophic.py Mon Aug 17 17:42:37 2020 +0100
+++ b/progs/catastrophic/catastrophic.py Sun Aug 23 23:44:44 2020 +0100
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+
import re
import sys
--- a/progs/matcher/re1.sc Mon Aug 17 17:42:37 2020 +0100
+++ b/progs/matcher/re1.sc Sun Aug 23 23:44:44 2020 +0100
@@ -7,7 +7,7 @@
// or
//
// amm re1.sc all
-
+
// regular expressions
abstract class Rexp
case object ZERO extends Rexp // matches nothing
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/progs/while-compiler-arrays/benchmark.bf Sun Aug 23 23:44:44 2020 +0100
@@ -0,0 +1,4 @@
+>++[<+++++++++++++>-]<[[>+>+<<-]>[<+>-]++++++++
+[>++++++++<-]>.[-]<<>++++++++++[>++++++++++[>++
+++++++++[>++++++++++[>++++++++++[>++++++++++[>+
++++++++++[-]<-]<-]<-]<-]<-]<-]<-]++++++++++.
\ No newline at end of file
--- a/progs/while-compiler-arrays/compile_bfc.sc Mon Aug 17 17:42:37 2020 +0100
+++ b/progs/while-compiler-arrays/compile_bfc.sc Sun Aug 23 23:44:44 2020 +0100
@@ -13,7 +13,7 @@
// * the jasmin assembly file is 236k
// * the resulting Java program takes about 20 secs
//
-// Call with (X being 0,1,..,4)
+// Call with (X being 0,1,..,5)
//
// amm compile_bfc.sc all
// amm compile_bfc.sc bfcX
@@ -248,23 +248,14 @@
}
// a benchmark program (counts down from 'Z' to 'A')
-val bf0 = """>++[<+++++++++++++>-]<[[>+>+<<-]>[<+>-]++++++++
- [>++++++++<-]>.[-]<<>++++++++++[>++++++++++[>++
- ++++++++[>++++++++++[>++++++++++[>++++++++++[>+
- +++++++++[-]<-]<-]<-]<-]<-]<-]<-]++++++++++."""
-
@doc(" Benchmark 'Z' to 'A'.")
@main
-def bfc0() = bf_run(bf0, "bench")
+def bfc0() = bf_run(read(pwd / "benchmark.bf"), "bench")
-// Sierpinski triangle
-val bf1 = """++++++++[>+>++++<<-]>++>>+<[-[>>+<<-]+>>]>+[-<<<[
- ->[+[-]+>++>>>-<<]<[<]>>++++++[<<+++++>>-]+<<++.[-]<<
- ]>.>+[>>]>+]"""
@doc(" Sierpinski triangle.")
@main
-def bfc1() = bf_run(bf1, "sier")
+def bfc1() = bf_run(read(pwd / "sierpinski.bf"), "sier")
// Hello World
val bf2 = """++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]
@@ -296,159 +287,18 @@
//----------------
//
// Note: Parsing of the generated WHILE program (around 60K in size)
-// takes approximately 10 minutes to parse with the parser combinators, and
-// approximately 30 seconds with fastparse
-
-
-val bf4 = """A mandelbrot set fractal viewer in brainf*** written by Erik Bosman
-+++++++++++++[->++>>>+++++>++>+<<<<<<]>>>>>++++++>--->>>>>>>>>>+++++++++++++++[[
->>>>>>>>>]+[<<<<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+// and approximately 30 seconds with Ammonite's fastparse.
@doc(" Mandelbrot set.")
@main
-def bfc4() = bf_run(bf4, "mand")
+def bfc4() = bf_run(read(pwd / "mandelbrot.bf"), "mand")
+
+
+// this hits the capacity of the JVM, even with optimisations
+//@doc(" Coolatz serries up to 30.")
+//@main
+//def bfc5() = bf_run(read(pwd / "collatz.bf"), "coll")
//
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/progs/while-compiler-arrays/mandelbrot.bf Sun Aug 23 23:44:44 2020 +0100
@@ -0,0 +1,145 @@
+ A mandelbrot set fractal viewer in brainf*** written by Erik Bosman
++++++++++++++[->++>>>+++++>++>+<<<<<<]>>>>>++++++>--->>>>>>>>>>+++++++++++++++[[
+>>>>>>>>>]+[<<<<<<<<<]>>>>>>>>>-]+[>>>>>>>>[-]>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>[-]+
+<<<<<<<+++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>>
+>+<<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+[>>>>>>[>>>>>>>[-]>>]<<<<<<<<<[<<<<<<<<<]>>
+>>>>>[-]+<<<<<<++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<+++++++[-[->>>
+>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[[-]>>>>>>[>>>>>
+>>[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<+<<<+<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>>
+[>>>>>>>>[-<<<<<<<+>>>>>>>]<<<<<<<[->>>>>>>+<<+<<<+<<]>>>>>>>>]<<<<<<<<<[<<<<<<<
+<<]>>>>>>>[-<<<<<<<+>>>>>>>]<<<<<<<[->>>>>>>+<<+<<<<<]>>>>>>>>>+++++++++++++++[[
+>>>>>>>>>]+>[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>>>->>[-<<<<<<<<+>>>>>>>>]<<<<<<<<[->>>>>>>>+<<<<<<<<<<<<<<<<<[<<<<<<<
+<<]>>>>[-]+>>>>>[>>>>>>>>>]>+<]]+>>>>>>>>[-<<<<<<<<->>>>>>>>]+<<<<<<<<[->>>>>>>>
+-<<[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+>>>>>>[>>>>>>
+>>>]>[-]+<]]+>[-<[>>>>>>>>>]<<<<<<<<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>[-]<<<++++
++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>->>>>>>>>>>>>>>>>>>>>>>>>>>>-<<<<<<[<<<<
+<<<<<]]>>>]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/progs/while-compiler-arrays/sierpinski.bf Sun Aug 23 23:44:44 2020 +0100
@@ -0,0 +1,3 @@
+++++++++[>+>++++<<-]>++>>+<[-[>>+<<-]+>>]>+[-<<<[
+->[+[-]+>++>>>-<<]<[<]>>++++++[<<+++++>>-]+<<++.[-]<<
+]>.>+[>>]>+]
Binary file slides/slides01.pdf has changed
--- a/slides/slides01.tex Mon Aug 17 17:42:37 2020 +0100
+++ b/slides/slides01.tex Sun Aug 23 23:44:44 2020 +0100
@@ -259,8 +259,9 @@
\begin{frame}[c]
\frametitle{Why Bother with Compilers?}
-\textbf{Boeings 777}: First flight in 1994. They want to achieve
-triple redundancy in hardware faults.\bigskip
+\textbf{Boeing 777's}: First flight in 1994. They want to achieve
+triple redundancy for potential hardware faults.
+\here{http://www.citemaster.net/get/db3a81c6-548e-11e5-9d2e-00163e009cc7/R8.pdf}\bigskip
They compile 1 Ada program to\medskip
@@ -273,17 +274,25 @@
using 3 independent compilers.\bigskip\pause
\small Airbus uses C and static analysers. Recently started using CompCert.
-
+
+\only<1->{%
+\begin{textblock}{6}(8,4.5)
+\includegraphics[scale=0.28]{../pics/777.png}
+\end{textblock}}
+
\end{frame}
%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c]
-\frametitle{Why Bother?}
+\frametitle{Why Bother with Regexes?}
-\begin{columns}[t]
-\begin{column}{.4\textwidth}
-Ruby, Python, Java 8\medskip\\
+\begin{columns}[t,onlytextwidth]
+\begin{column}{1.8cm}
+\mbox{}
+\end{column}
+\begin{column}{.5\textwidth}
+\small{}Ruby, Python, Java 8\medskip\\
\begin{tikzpicture}\footnotesize
\begin{axis}[
xlabel={$n$},
@@ -296,7 +305,7 @@
ytick={0,5,...,30},
scaled ticks=false,
axis lines=left,
- width=5.5cm,
+ width=\textwidth,
height=4cm,
legend entries={Python,Ruby},
legend pos=north west,
@@ -317,7 +326,7 @@
ytick={0,5,...,30},
scaled ticks=false,
axis lines=left,
- width=5.5cm,
+ width=\textwidth,
height=4cm,
legend entries={Python, Java 8, JavaScript},
legend pos=north west,
@@ -327,10 +336,10 @@
\addplot[red,mark=*, mark options={fill=white}] table {re-js.data};
\end{axis}
\end{tikzpicture}
-
+%
\end{column}
-\begin{column}{.4\textwidth}
-Us (after next lecture)\medskip\\
+\begin{column}{.5\textwidth}
+\small{}Us (after next lecture)\medskip\\
\begin{tikzpicture}\footnotesize
\begin{axis}[
xlabel={$n$},
@@ -343,7 +352,7 @@
ytick={0,5,...,30},
scaled ticks=false,
axis lines=left,
- width=5.5cm,
+ width=\textwidth,
height=4cm]
\addplot[green,mark=square*,mark options={fill=white}] table {re2.data};
\addplot[black,mark=square*,mark options={fill=white}] table {re3.data};
@@ -359,17 +368,28 @@
ytick={0,5,...,30},
scaled ticks=false,
axis lines=left,
- width=5.5cm,
+ width=\textwidth,
height=4cm]
\addplot[black,mark=square*,mark options={fill=white}] table {re3a.data};
\end{axis}
\end{tikzpicture}
\end{column}
-\end{columns}\bigskip
+\end{columns}
+\medskip
+
+\begin{textblock}{3}(-0.1,3.3)
+\small\hfill\bl{\texttt{[a?]\{n\}[a]\{n\}}}:
+\end{textblock}
-\small\centering
-matching \bl{\texttt{[a?]\{n\}[a]\{n\}}} and \bl{\texttt{(a*)*b}}
-against \bl{$\underbrace{\texttt{a}...\texttt{a}}_n$}
+\begin{textblock}{3}(-0.1,8.7)
+\small\hfill\bl{\texttt{(a*)*b}}:
+\end{textblock}
+
+\begin{textblock}{3}(0.3,13)
+\small{}matching with strings
+\bl{$\underbrace{\texttt{a}...\texttt{a}}_n$}
+\end{textblock}
+
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -390,13 +410,16 @@
\end{center}\bigskip\bigskip\bigskip\bigskip\bigskip\bigskip\bigskip
\item on 20 July 2016 the \textbf{Stack Exchange} webpage went down
- because of an evil regular expression
+ because of an evil regular expression
+ \here{https://stackstatus.net/post/147710624694/outage-postmortem-july-20-2016}
\end{itemize}
- \begin{textblock}{6}(9,7.6)
+ \begin{textblock}{6}(6,7.6)
\includegraphics[scale=0.14]{../pics/cloudflare.png}\\
\footnotesize
- It serves more web traffic than Twitter, Amazon, Apple, Instagram, Bing \& Wikipedia combined.
+ It serves more web traffic than Twitter, Amazon, Apple,
+ Instagram, Bing \& Wikipedia combined.
+ \here{https://blog.cloudflare.com/details-of-the-cloudflare-outage-on-july-2-2019/}
\end{textblock}
\end{frame}
@@ -408,13 +431,13 @@
\begin{itemize}
\item \alert{R}egular \alert{e}xpression \alert{D}enial \alert{o}f \alert{S}ervice (ReDoS)\medskip
-\item Evil regular expressions\medskip
+\item Some evil regular expressions:\medskip
\begin{itemize}
-\item \bl{$(a^{?\{n\}}) \cdot a^{\{n\}}$}
-\item \bl{$(a^*)^*\cdot b$}
-\item \bl{$([a-z]^+)^*$}
-\item \bl{$(a + a \cdot a)^*$}
-\item \bl{$(a + a^?)^*$}
+\item \bl{\texttt{[a?]\{n\}\;[a]\{n\}}}
+\item \bl{\texttt{(a*)*\;b}}
+\item \bl{\texttt{([a-z]+)*}}
+\item \bl{\texttt{(a + aa)*}}
+\item \bl{\texttt{(a + a?)*}}
\end{itemize}
\item sometimes also called \alert{catastrophic backtracking}
@@ -427,7 +450,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[c]
+\begin{frame}[t]
\frametitle{The Acad.~Subject is Mature}
\bigskip
@@ -437,26 +460,28 @@
\item The first compiler for COBOL, 1957\\ (Grace Hopper)\medskip
\item But surprisingly research papers are still published nowadays\\
\item ``Parsing: The Solved Problem That Isn't''
+ \here{https://tratt.net/laurie/blog/entries/parsing_the_solved_problem_that_isnt.html}
\end{itemize}
+
+\begin{textblock}{8.5}(5,7.6)
\begin{flushright}
\includegraphics[scale=0.3]{pics/hopper.jpg}\\
-\footnotesize\textcolor{gray}{Grace Hopper}
-\end{flushright}
-
+\footnotesize\textcolor{gray}{Grace Hopper}\smallskip\\
-\begin{flushright}
-\mbox{}\\[-6mm]
-{\footnotesize\textcolor{gray}{(she made it to David Letterman's Tonight Show,\\[-2mm]
- \url{https://youtu.be/3N_ywhx6_K0?t=31})}}
+{\small\textcolor{gray}{(she made it to David Letterman's Tonight Show
+ \here{https://youtu.be/3N_ywhx6_K0?t=31})}}
\end{flushright}
+\end{textblock}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c]
-\frametitle{Remember BF*** from PEP?}
+\frametitle{What Do Compilers Do?}
+
+Remember BF*** from PEP?
\begin{center}
\begin{tabular}{lcl}
@@ -477,7 +502,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c]
- \frametitle{A ``Compiler'' for BF***}
+ \frametitle{A ``Compiler'' for BF*** to C}
\begin{center}
\begin{tabular}{lcl}
@@ -525,17 +550,18 @@
\begin{frame}[c]
\frametitle{Lectures 5 - 10}
- code generation for a small imperative and a small functional languages\\[10mm]
+ code generation for a small imperative and a small functional language\\[10mm]
{\LARGE\bf Interpreters}\medskip\\
\hspace{5mm}(directly runs a program)\\[6mm]
{\LARGE\bf Compilers}\medskip\\
- \hspace{5mm}(generates JVM code)
+ \hspace{5mm}(generate JVM code and LLVM-IR code)
- \begin{textblock}{1}(10,8.1)
- \begin{tabular}{c}
- \includegraphics[scale=0.4]{../pics/javaduke.png}
+ \begin{textblock}{1}(8.8,8.1)
+ \begin{tabular}{c@{}c}
+ \includegraphics[scale=0.4]{../pics/javaduke.png} &
+ \includegraphics[scale=0.23]{../pics/llvmlogo.png}
\end{tabular}
\end{textblock}
@@ -879,10 +905,8 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\mode<presentation>{
\begin{frame}[c]
-\frametitle{\begin{tabular}{c}The Meaning of a\\[-2mm]
- Regular Expression\end{tabular}}
+\frametitle{The Meaning of a Regex}
\begin{textblock}{15}(1,4)
\begin{tabular}{rcl}
@@ -901,7 +925,7 @@
}
\end{textblock}
-\end{frame}}
+\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1023,9 +1047,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c]
-\frametitle{
- The Meaning of a\\[-2mm]
- Regular Expression}
+\frametitle{The Meaning of a Regex}
...all the strings a regular expression can match.
@@ -1177,24 +1199,24 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[c]
-\frametitle{Lecture Capture}
-
-\begin{itemize}
-\item Hope it works\ldots\pause actually no, it does not!\medskip\pause
-\item It is important to use lecture capture wisely\\ (it is only the ``baseline''):
-\begin{itemize}
-\item Lecture recordings are a study and revision aid.
-\item Statistically, there is a clear and direct link between attendance and
- attainment: students who do not attend lectures, do less well in exams.
-\end{itemize}
-
-\item Attending a lecture is more than watching it online -- if you do not
-attend, you miss out!
-
-\end{itemize}
-
-\end{frame}
+%\begin{frame}[c]
+%\frametitle{Lecture Capture}
+%
+%\begin{itemize}
+%\item Hope it works\ldots\pause actually no, it does not!\medskip\pause
+%\item It is important to use lecture capture wisely\\ (it is only the ``baseline''):
+%\begin{itemize}
+%\item Lecture recordings are a study and revision aid.
+%\item Statistically, there is a clear and direct link between attendance and
+% attainment: students who do not attend lectures, do less well in exams.
+%\end{itemize}
+%
+%\item Attending a lecture is more than watching it online -- if you do not
+%attend, you miss out!
+%
+%\end{itemize}
+%
+%\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%