11/9/2020 Grok | COMP30026 Practice Exam
Ques on 7
Ques on 7 Part A (1 mark)
Recall the reverse opera on on languages (over alphabet ) defined as follows:
In words, is the language of all strings appearing backwards in . As an example, if is then is .
Part A (1 mark)
Let be the language of the regular expression expression for ?
Instruc ons
GiveyouranswerasaHaskellexpressionr7A :: RegExp. Format
. What is a regular
RegExp.hs provides a regular expression type RegExp, and a parser for regular expressions,parseRE :: String -> RegExp.Usethistypetoenteryouranswer.
For example:
The regular expression may be entered as follows:
Star (Concat (Symbol ‘b’) (Symbol ‘a’)),or
parseRE “(ba)*”.
The regular expression may be entered as follows:
Concat (Symbol ‘a’) (Union EmptyStr (Concat (Symbol ‘a’) (Symbol ‘b’))),or
parseRE “a(eps | ab)”.
https://groklearning.com/learn/unimelb-comp30026-2020-s2/prac-exam/17/ 1/1
Cheng
)ba ∪ ε(a
∗)ab(
RA 1∗)1∪0(∪ε A
}110 ,10 ,0{ RL }011 ,01 ,0{ LL RL
.}i lla rof Σ ∈ ix ,L ∈ nx ⋯ 1x0x | 0x1x ⋯ nx{ = RL Σ