updated
authorChristian Urban <urbanc@in.tum.de>
Thu, 03 Aug 2017 01:21:19 +0100
changeset 498 ea47c3b8f35f
parent 497 c498cb53a9a8
child 499 dfd0f41f8668
updated
hws/hw01.pdf
hws/hw01.tex
hws/hw04.pdf
hws/hw04.tex
progs/re1.scala
Binary file hws/hw01.pdf has changed
--- a/hws/hw01.tex	Wed Jun 28 12:46:23 2017 +0100
+++ b/hws/hw01.tex	Thu Aug 03 01:21:19 2017 +0100
@@ -29,10 +29,11 @@
 
 \item Read the handout of the first lecture and the handout
       about notation. Make sure you understand the concepts of
-      strings and languages. In the context of the AFL-course,
+      strings and languages. In the context of the CFL-course,
       what is meant by the term \emph{language}?
 
-\item Give the definition for regular expressions. What is the
+    \item Give the definition for regular expressions---this is an
+      inductive datatype. What is the
       meaning of a regular expression? (Hint: The meaning is
       defined recursively.)
 
@@ -41,6 +42,7 @@
       \emph{concatenating} two sets of strings. This operation
       is also written as $\_ \,@\, \_$. According to 
       this definition, what is $A \,@\, \{\}$ equal to?
+      Is in general $A\,@\,B$ equal to $B\,@\,A$?
 
 \item Assume a set $A$ contains 4 strings and a set $B$
       contains 7 strings. None of the strings is the empty
Binary file hws/hw04.pdf has changed
--- a/hws/hw04.tex	Wed Jun 28 12:46:23 2017 +0100
+++ b/hws/hw04.tex	Thu Aug 03 01:21:19 2017 +0100
@@ -97,7 +97,13 @@
 
 \item What is the purpose of the record regular expression in
       the Sulzmann \& Lu algorithm?
-  
+
+\item Recall the functions \textit{nullable} and \textit{zeroable}.
+  Define recursive functions \textit{atmostempty} (for regular expressions
+  that match no string or only the empty string), \textit{somechars} (for regular
+  expressions that match some non-empty string), \textit{infinitestrings} (for regular
+  expressions that can match infinitely many strings). 
+      
   
 %\item (Optional) The tokenizer in \texttt{regexp3.scala} takes as
 %argument a string and a list of rules. The result is a list of tokens. Improve this tokenizer so 
--- a/progs/re1.scala	Wed Jun 28 12:46:23 2017 +0100
+++ b/progs/re1.scala	Thu Aug 03 01:21:19 2017 +0100
@@ -1,5 +1,6 @@
 // Simple matcher for basic regular expressions
 
+object Test {
 
 abstract class Rexp
 case object ZERO extends Rexp                    // matches nothing
@@ -21,6 +22,8 @@
 
 }
 
+}
+
 // derivative of a regular expression w.r.t. a character
 def der (c: Char, r: Rexp) : Rexp = r match {
   case ZERO => ZERO