1
1 Seq(Left(Seq(a, b)), Left(Empty)) POSIX Seq(Right(a), Right(b))
2 Stars(Left(Seq(a, a)), Right(a)) POSIX Stars(Right(a), Left(Seq(a, a))) Stars(Right(a), Right(a), Right(a))
2
If we’re only using basic regular expressions, no. With extended regular expressions such as intersection, we can have an empty language for a regex such as .
We can use proof by induction here. [try this as an exercise?]
3
numbers = LP = RP = ID = OP =
- LP, ID(a), OP(+), numbers(3), RP, OP(*), ID(b)
- RP, LP, RP, OP(+), OP(+), OP(-), numbers(33)
- Cannot be lexed.
4
[LOOK OVER THIS] If , then
5
UPPER = LOWER = DIGIT = ANY =
PASSWORD =
6
7
[COPY SOLUTION]
8
Right(Right(Empty)) Seq(Right(Empty), Left(Empty)) Stars[]
9
Record regular expression allows us to mark parts of our matched string to later extract information out of the string.
10
atmostempty
somechars
infinitestrings
11
We may encounter catastrophic backtracking with specially crafted inputs. We will have 1000 copies of some NFA / DFA, may not even have memory.