coursework/cw02.tex
changeset 458 896a5f91838d
parent 447 68769db65185
child 468 bab72d4ac90e
equal deleted inserted replaced
457:921fdd17d2b8 458:896a5f91838d
    93 $r^?$ & optional $r$\\
    93 $r^?$ & optional $r$\\
    94 $r^{\{n\}}$ & n-times $r$\\
    94 $r^{\{n\}}$ & n-times $r$\\
    95 \end{tabular}
    95 \end{tabular}
    96 \end{center}
    96 \end{center}
    97 
    97 
       
    98 \noindent
       
    99 Later on you will also need the record regular expressions:
       
   100 
       
   101 \begin{center}
       
   102 \begin{tabular}{ll}
       
   103 $REC(x:r)$ & record regular expression\\
       
   104 \end{tabular}
       
   105 \end{center}
       
   106 
    98 \noindent Try to design your regular expressions to be as
   107 \noindent Try to design your regular expressions to be as
    99 small as possible. For example you should use character ranges
   108 small as possible. For example you should use character ranges
   100 for identifiers and numbers.
   109 for identifiers and numbers.
   101 
   110 
   102 \subsection*{Question 2}
   111 \subsection*{Question 2}
   127 
   136 
   128 \begin{center}
   137 \begin{center}
   129 \begin{tabular}{ll}
   138 \begin{tabular}{ll}
   130 regex: & string:\smallskip\\
   139 regex: & string:\smallskip\\
   131 $a^{\{3\}}$ & $aaa$\\
   140 $a^{\{3\}}$ & $aaa$\\
   132 $(a + \epsilon)^{\{3\}}$ & $aa$
   141 $(a + \ONE)^{\{3\}}$ & $aa$
   133 \end{tabular}
   142 \end{tabular}
   134 \end{center}
   143 \end{center}
   135 
   144 
   136 
   145 
   137 \noindent Both strings should be sucessfully lexed by the
   146 \noindent Both strings should be sucessfully lexed by the