diff -r d3d371ae5fab -r 19a5d332cb49 cws/cw02.tex --- a/cws/cw02.tex Sun Sep 10 12:24:55 2023 +0100 +++ b/cws/cw02.tex Fri Sep 15 10:49:33 2023 +0100 @@ -2,6 +2,7 @@ \documentclass{article} \usepackage{../style} \usepackage{../langs} +\usepackage[normalem]{ulem} \begin{document} @@ -12,19 +13,22 @@ WHILE language. You can do the implementation in any programming language you like, but you need to submit the source code with which you answered the questions, otherwise a mark of 0\% will be -awarded. You can submit your answers in a txt-file or as pdf. Code -submit as code. Please package everything in a zip-file that creates a -directory with the name \texttt{YournameYourfamilyname} on my end. Thanks! +awarded. You need to submit your written +answers as pdf---see attached questionaire. Code send as code. If you use +Scala in your code, a good place to start is the file \texttt{re3.sc} +that is uploaded to Github. \subsection*{Disclaimer\alert} It should be understood that the work you submit represents -your own effort. You have not copied from anyone else. An +your own effort. You have not copied from anyone else +including CoPilot, ChatGPT \& Co. An exception is the Scala code from KEATS and the code I showed during the lectures, which you can both freely use. You can -also use your own code from the CW~1. But do not -be tempted to ask Github Copilot for help or do any other -shenanigans like this! +also use your own code from the CW~1. +%But do not +%be tempted to ask Github Copilot for help or do any other +%shenanigans like this! \subsection*{Question 1} @@ -132,7 +136,8 @@ this you need to implement the functions $nullable$ and $der$ (you can use your code from CW~1), as well as $mkeps$ and $inj$. These functions need to be appropriately extended for -the extended regular expressions from Q1. Write down the +the extended regular expressions from Q1. Write down in the +questionaire at the end the clauses for \begin{center} @@ -217,6 +222,45 @@ between 1 and 100.\label{collatz}} \end{figure} +\clearpage +\newpage +\section*{Answers} + +\mbox{} + +\noindent +\textbf{Question 2:} + +\begin{center} + \def\arraystretch{1.6} +\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}} +$mkeps([c_1,c_2,\ldots,c_n])$ & $\dn$ & \uline{\hspace{8cm}}\\ +$mkeps(r^+)$ & $\dn$ & \uline{\hspace{8cm}}\\ +$mkeps(r^?)$ & $\dn$ & \uline{\hspace{8cm}}\\ +$mkeps(r^{\{n\}})$ & $\dn$ & \uline{\hspace{8cm}}\bigskip\\ +$inj\, ([c_1,c_2,\ldots,c_n])\,c\,\ldots$ & $\dn$ & \uline{\hspace{8cm}}\\ +$inj\, (r^+)\,c\,\ldots$ & $\dn$ & \uline{\hspace{8cm}}\\ +$inj\, (r^?)\,c\,\ldots$ & $\dn$ & \uline{\hspace{8cm}}\\ +$inj\, (r^{\{n\}})\,c\,\ldots$ & $\dn$ & \uline{\hspace{8cm}}\\ +\end{tabular} +\end{center}\bigskip + +\noindent +Tokens for \code{"read n;"}\\ + +\noindent +\uline{\hfill}\medskip + +\noindent +\uline{\hfill}\medskip + +\noindent +\uline{\hfill}\medskip + +\noindent +\uline{\hfill}\medskip + + \end{document} %%% Local Variables: