diff -r 603e171a7b48 -r b3129cff41e9 coursework/cw02.tex --- a/coursework/cw02.tex Mon Oct 19 15:03:44 2015 +0100 +++ b/coursework/cw02.tex Mon Oct 19 23:49:25 2015 +0100 @@ -6,27 +6,28 @@ \section*{Coursework 2 (Strand 1)} -\noindent -This coursework is worth 5\% and is due on 6 November at 16:00. You -are asked to implement the Sulzmann tokeniser for the WHILE language. -You need to submit a document containing the answers for the questions -below. 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. However, the coursework will \emph{only} be judged -according to the answers. You can submit your answers in a txt-file or -as pdf. +\noindent This coursework is worth 5\% and is due on 6 +November at 16:00. You are asked to implement the Sulzmann \& +Lu tokeniser for the 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. However, +the coursework will \emph{only} be judged according to the +answers. You can submit your answers in a txt-file or as pdf. \subsection*{Disclaimer} -It should be understood that the work you submit represents your own -effort. You have not copied from anyone else. An exception is the -Scala code I showed during the lectures, which you can use. -You can also use your own code from the CW~1. +It should be understood that the work you submit represents +your own effort. You have not copied from anyone else. An +exception is the Scala code I showed during the lectures, +which you can use. You can also use your own code from the +CW~1. \subsection*{Question 1 (marked with 1\%)} -To implement a tokeniser for the WHILE language, you first need to design -the appropriate regular expressions for the following eight syntactic entities: +To implement a tokeniser for the WHILE language, you first +need to design the appropriate regular expressions for the +following eight syntactic entities: \begin{enumerate} \item keywords are @@ -95,17 +96,17 @@ \subsection*{Question 2 (marked with 3\%)} -Implement the Sulzmann tokeniser from the lectures. For 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. Also add the record regular expression from the lectures and -implement a function, say \pcode{env}, that returns all assignments -from a value (such that you can extract easily the tokens from a -value). +Implement the Sulzmann \& Lu tokeniser from the lectures. For +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. Also add the record +regular expression from the lectures and implement a function, +say \pcode{env}, that returns all assignments from a value +(such that you can extract easily the tokens from a value). -The functions $mkeps$ and $inj$ return values. Calculate -the value for your regular expressions from Q1 and the string +The functions $mkeps$ and $inj$ return values. Calculate the +value for your regular expressions from Q1 and the string \begin{center} \code{"read n;"}