程序代写代做代考 C 11/9/2020 Grok | COMP30026 Practice Exam

11/9/2020 Grok | COMP30026 Practice Exam
Queson 6
Queson 6 Part C (3 marks)
We define the simplicity of a regular expression as the total number of occurrences of concatenaons, unions, Kleene stars, alphabet symbols, empty string symbols, and empty set symbols in the regular expression. The simplest regular expression for a regular language is the regular expression with the smallest possible simplicity expressing that language.
For example, the regular expression has two concatenaons, one union, one Kleene star, one empty string symbol, and three alphabet symbols, for a total
simplicity of 8. However, it is not the simplest possible regular expression for its language; expresses the same language, and has simplicity 6.
Part C (3 marks)
Let be the context-free grammar
Let be the context-free grammar is
It turns out that is regular.
What is the simplest regular expression for language
where the set of rules is
where the set of rules
?
Note: Paral marks will be awarded for a regular expression which is correct but not the simplest.
Instrucons
Giveyouranswerasaregularexpressionr6C :: RegExp.  Format
RegExp.hs provides a regular expression type RegExp, and a parser for regular expressions,parseRE :: String -> RegExp.Usethistypetoenteryouranswer.
https://groklearning.com/learn/unimelb-comp30026-2020-s2/prac-exam/16/ 1/1
Cheng
)′G(L ∪ )G(L
Ub| Ua|ε→U bTb|aTa|U→T
′R )T,′R,}b,a{,}U,T{( ′G bSa|ε→S
R )S ,R ,}b ,a{ ,}S{(
G
∗)aba ∪ ε(
)′G(L ∪ )G(L
∗)aba(