updated
authorChristian Urban <christian.urban@kcl.ac.uk>
Fri, 18 Oct 2024 05:45:14 +0100
changeset 969 0dfa2923a7c6
parent 968 d8d8911a3d6f
child 970 1d4659dd83fe
updated
cws/cw01.pdf
cws/cw02.pdf
cws/cw02.tex
cws/cw03.pdf
cws/cw04.pdf
cws/cw05.pdf
progs/lexer/lexer.sc
slides/slides03.pdf
slides/slides04.pdf
slides/slides04.tex
Binary file cws/cw01.pdf has changed
Binary file cws/cw02.pdf has changed
--- 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}
Binary file cws/cw03.pdf has changed
Binary file cws/cw04.pdf has changed
Binary file cws/cw05.pdf has changed
--- 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
+*/
Binary file slides/slides03.pdf has changed
Binary file slides/slides04.pdf has changed
--- 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}}\\