handouts/ho01.tex
changeset 258 1e4da6d2490c
parent 252 e8ef8f38ca84
child 268 18bef085a7ca
equal deleted inserted replaced
257:70c307641d05 258:1e4da6d2490c
   158      \draw (\x,1pt) -- (\x,-3pt) node[anchor=north] {\x};
   158      \draw (\x,1pt) -- (\x,-3pt) node[anchor=north] {\x};
   159    \foreach \y in {0,5,...,30}
   159    \foreach \y in {0,5,...,30}
   160      \draw (1pt,\y) -- (-3pt,\y) node[anchor=east] {\y}; 
   160      \draw (1pt,\y) -- (-3pt,\y) node[anchor=east] {\y}; 
   161 	%labels      
   161 	%labels      
   162 	\node[below=0.6cm] at (x axis mid) {number of \texttt{a}s};
   162 	\node[below=0.6cm] at (x axis mid) {number of \texttt{a}s};
   163 	\node[rotate=90,above=0.8cm] at (y axis mid) {time in secs};
   163 	\node[rotate=90,left=0.9cm] at (y axis mid) {time in secs};
   164 	%plots
   164 	%plots
   165 	\draw[color=blue] plot[mark=*] 
   165 	\draw[color=blue] plot[mark=*] 
   166 		file {re-python.data};
   166 		file {re-python.data};
   167 	\draw[color=brown] plot[mark=triangle*] 
   167 	\draw[color=brown] plot[mark=triangle*] 
   168 		file {re-ruby.data};	 
   168 		file {re-ruby.data};	 
   220      	\draw (\x,1pt) -- (\x,-3pt) node[anchor=north] {\x};
   220      	\draw (\x,1pt) -- (\x,-3pt) node[anchor=north] {\x};
   221    \foreach \y in {0,5,...,30}
   221    \foreach \y in {0,5,...,30}
   222      	\draw (1pt,\y) -- (-3pt,\y) node[anchor=east] {\y}; 
   222      	\draw (1pt,\y) -- (-3pt,\y) node[anchor=east] {\y}; 
   223 	%labels      
   223 	%labels      
   224 	\node[below=0.6cm] at (x axis mid) {number of \texttt{a}s};
   224 	\node[below=0.6cm] at (x axis mid) {number of \texttt{a}s};
   225 	\node[rotate=90, above=0.8cm] at (y axis mid) {time in secs};
   225 	\node[rotate=90,left=0.9cm] at (y axis mid) {time in secs};
   226 
   226 
   227 	%plots
   227 	%plots
   228    \draw[color=green] plot[mark=square*, mark options={fill=white} ] 
   228    \draw[color=green] plot[mark=square*, mark options={fill=white} ] 
   229 		file {re2b.data};
   229 		file {re2b.data};
   230 	\draw[color=black] plot[mark=square*, mark options={fill=white} ] 
   230 	\draw[color=black] plot[mark=square*, mark options={fill=white} ] 
   245 grammar:
   245 grammar:
   246 
   246 
   247 \begin{center}
   247 \begin{center}
   248 \begin{tabular}{r@{\hspace{1mm}}r@{\hspace{1mm}}l@{\hspace{13mm}}l}
   248 \begin{tabular}{r@{\hspace{1mm}}r@{\hspace{1mm}}l@{\hspace{13mm}}l}
   249   $r$ & $::=$ &   $\varnothing$         & null\\
   249   $r$ & $::=$ &   $\varnothing$         & null\\
   250         & $\mid$ & $\epsilon$           & empty string / "" / []\\
   250         & $\mid$ & $\epsilon$           & empty string / \texttt{""} / []\\
   251         & $\mid$ & $c$                  & single character\\
   251         & $\mid$ & $c$                  & single character\\
   252         & $\mid$ & $r_1 + r_2$          & alternative / choice\\
   252         & $\mid$ & $r_1 + r_2$          & alternative / choice\\
   253         & $\mid$ & $r_1 \cdot r_2$      & sequence\\
   253         & $\mid$ & $r_1 \cdot r_2$      & sequence\\
   254         & $\mid$ & $r^*$                & star (zero or more)\\
   254         & $\mid$ & $r^*$                & star (zero or more)\\
   255   \end{tabular}
   255   \end{tabular}
   442 
   442 
   443 \[
   443 \[
   444 \varnothing^* \equiv \epsilon^*
   444 \varnothing^* \equiv \epsilon^*
   445 \]
   445 \]
   446 
   446 
   447 \noindent holds. Such equivalences will be important for our
   447 \noindent holds? Such equivalences will be important for our
   448 matching algorithm, because we can use them to simplify 
   448 matching algorithm, because we can use them to simplify 
   449 regular expressions. 
   449 regular expressions. 
   450 
   450 
   451 \subsection*{My Fascination for Regular Expressions}
   451 \subsection*{My Fascination for Regular Expressions}
   452 
   452