123 \subsection*{Question 3} |
123 \subsection*{Question 3} |
124 |
124 |
125 From the |
125 From the |
126 lectures you have seen the definitions for the functions |
126 lectures you have seen the definitions for the functions |
127 \textit{nullable} and \textit{der} for the basic regular |
127 \textit{nullable} and \textit{der} for the basic regular |
128 expressions. Implement and write down rules for the extended |
128 expressions. Implement and write down the rules for the extended |
129 regular expressions: |
129 regular expressions: |
130 |
130 |
131 \begin{center} |
131 \begin{center} |
132 \begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}} |
132 \begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}} |
133 $\textit{nullable}([c_1,c_2,\ldots,c_n])$ & $\dn$ & $?$\\ |
133 $\textit{nullable}([c_1,c_2,\ldots,c_n])$ & $\dn$ & $?$\\ |
168 expression matcher with (at least) the examples: |
168 expression matcher with (at least) the examples: |
169 |
169 |
170 |
170 |
171 \begin{center} |
171 \begin{center} |
172 \def\arraystretch{1.2} |
172 \def\arraystretch{1.2} |
173 \begin{tabular}{r|m{12mm}|m{12mm}|m{12mm}|m{12mm}|m{12mm}|m{12mm}} |
173 \begin{tabular}{@{}r|m{6mm}|m{6mm}|m{6mm}|m{10mm}|m{10mm}|m{10mm}|m{10mm}|m{10mm}} |
174 string & $a^{\{3\}}$ & $(a^?)^{\{3\}}$ & $a^{\{..3\}}$ & |
174 string & $a^?$ & $\sim{}a$ & $a^{\{3\}}$ & $(a^?)^{\{3\}}$ & $a^{\{..3\}}$ & |
175 $(a^?)^{\{..3\}}$ & $a^{\{3..5\}}$ & $(a^?)^{\{3..5\}}$\\\hline |
175 $(a^?)^{\{..3\}}$ & $a^{\{3..5\}}$ & $(a^?)^{\{3..5\}}$ \\\hline |
176 $[]$ &&&&&& \\\hline |
176 $[]$ &&&&&&& \\\hline |
177 \texttt{a} &&&&&& \\\hline |
177 \texttt{a} &&&&&&& \\\hline |
178 \texttt{aa} &&&&&& \\\hline |
178 \texttt{aa} &&&&&&& \\\hline |
179 \texttt{aaa} &&&&&& \\\hline |
179 \texttt{aaa} &&&&&&& \\\hline |
180 \texttt{aaaaa} &&&&&& \\\hline |
180 \texttt{aaaaa} &&&&&&& \\\hline |
181 \texttt{aaaaaa}&&&&&& \\ |
181 \texttt{aaaaaa}&&&&&&& \\ |
182 \end{tabular} |
182 \end{tabular} |
183 \end{center} |
183 \end{center} |
184 |
184 |
185 \noindent |
185 \noindent |
186 Does your matcher produce the expected results? |
186 Does your matcher produce the expected results? Make sure you |
|
187 also test corner-cases, like $a^{\{0\}}$! |
187 |
188 |
188 \subsection*{Question 4} |
189 \subsection*{Question 4} |
189 |
190 |
190 As you can see, there are a number of explicit regular expressions |
191 As you can see, there are a number of explicit regular expressions |
191 that deal with single or several characters, for example: |
192 that deal with single or several characters, for example: |