handouts/ho01.tex
changeset 742 b5b5583a3a08
parent 723 16db16950593
child 743 6acabeecdf75
--- a/handouts/ho01.tex	Mon Jul 27 11:02:48 2020 +0100
+++ b/handouts/ho01.tex	Thu Jul 30 13:50:54 2020 +0100
@@ -46,6 +46,7 @@
 
 \section*{Handout 1}
 
+
 The purpose of a compiler is to transform a program a human can read and
 write into code the machine can run as fast as possible. Developing a
 compiler is an old craft going back to 1952 with the first compiler
@@ -479,8 +480,18 @@
 structure of regular expressions is always clear. But for
 writing them down in a more mathematical fashion, parentheses
 will be helpful. For example we will write $(r_1 + r_2)^*$,
-which is different from, say $r_1 + (r_2)^*$. The former means
-roughly zero or more times $r_1$ or $r_2$, while the latter
+which is different from, say $r_1 + (r_2)^*$. This can be
+seen if we write regular expressions as trees:
+
+\begin{center}
+\includegraphics[scale=0.65]{../pics/r1.pdf}
+\hspace{3cm}
+\includegraphics[scale=0.65]{../pics/r2.pdf}
+\end{center}
+
+\noindent
+The regular expression on the left means
+roughly zero or more times $r_1$ or $r_2$, while the one on the right
 means $r_1$, or zero or more times $r_2$. This will turn out to
 be two different patterns, which match in general different
 strings. We should also write $(r_1 + r_2) + r_3$, which is