# HG changeset patch # User Christian Urban # Date 1729226714 -3600 # Node ID 0dfa2923a7c6f198fd8f9d745cd8adae3e2e6216 # Parent d8d8911a3d6f74a963eb316861cf20d7825c68f2 updated diff -r d8d8911a3d6f -r 0dfa2923a7c6 cws/cw01.pdf Binary file cws/cw01.pdf has changed diff -r d8d8911a3d6f -r 0dfa2923a7c6 cws/cw02.pdf Binary file cws/cw02.pdf has changed diff -r d8d8911a3d6f -r 0dfa2923a7c6 cws/cw02.tex --- a/cws/cw02.tex Wed Oct 16 13:14:13 2024 +0100 +++ b/cws/cw02.tex Fri Oct 18 05:45:14 2024 +0100 @@ -24,8 +24,12 @@ 3 marks are given for the correct \texttt{WHILE\_REGS} regular expression; 5 marks for the correct \texttt{inj} and \texttt{mkeps} definitions; and two marks when \texttt{tokenise} produces the correct -results for the example files. +results for the example files. +\subsection*{Testing\alert} + +For the marking, the functions that will be tested are +\texttt{tokenise}, \texttt{inj} and \texttt{mkeps}. \subsection*{Disclaimer\alert} diff -r d8d8911a3d6f -r 0dfa2923a7c6 cws/cw03.pdf Binary file cws/cw03.pdf has changed diff -r d8d8911a3d6f -r 0dfa2923a7c6 cws/cw04.pdf Binary file cws/cw04.pdf has changed diff -r d8d8911a3d6f -r 0dfa2923a7c6 cws/cw05.pdf Binary file cws/cw05.pdf has changed diff -r d8d8911a3d6f -r 0dfa2923a7c6 progs/lexer/lexer.sc --- a/progs/lexer/lexer.sc Wed Oct 16 13:14:13 2024 +0100 +++ b/progs/lexer/lexer.sc Fri Oct 18 05:45:14 2024 +0100 @@ -33,6 +33,7 @@ case class Rec(x: String, v: Val) extends Val // some convenience for typing in regular expressions +import scala.language.implicitConversions def charlist2rexp(s : List[Char]): Rexp = s match { case Nil => ONE @@ -40,9 +41,7 @@ case c::s => SEQ(CHAR(c), charlist2rexp(s)) } -implicit def string2rexp(s : String) : Rexp = - charlist2rexp(s.toList) - +given Conversion[String, Rexp] = (s => charlist2rexp(s.toList)) extension (s: String) { def $ (r: Rexp) = RECD(s, r) @@ -239,8 +238,9 @@ // escapes strings and prints them out as "", "\n" and so on def esc(raw: String): String = { - import scala.reflect.runtime.universe._ - Literal(Constant(raw)).toString + raw + //import scala.reflect.runtime.universe._ + //Literal(Constant(raw)).toString } def escape(tks: List[(String, String)]) = @@ -344,4 +344,4 @@ println(s) println(e) -*/ \ No newline at end of file +*/ diff -r d8d8911a3d6f -r 0dfa2923a7c6 slides/slides03.pdf Binary file slides/slides03.pdf has changed diff -r d8d8911a3d6f -r 0dfa2923a7c6 slides/slides04.pdf Binary file slides/slides04.pdf has changed diff -r d8d8911a3d6f -r 0dfa2923a7c6 slides/slides04.tex --- a/slides/slides04.tex Wed Oct 16 13:14:13 2024 +0100 +++ b/slides/slides04.tex Fri Oct 18 05:45:14 2024 +0100 @@ -39,7 +39,7 @@ \begin{center} \begin{tabular}{ll} Email: & christian.urban at kcl.ac.uk\\ - Office Hour: & Thurdays 15 -- 16\\ + Office Hour: & Fridays 12 -- 14\\ Location: & N7.07 (North Wing, Bush House)\\ Slides \& Progs: & KEATS\\ Pollev: & \texttt{\alert{https://pollev.com/cfltutoratki576}}\\