Write a program that allows users to implement and define regular expressions in Haskell language.
Requirements and Specifications
For each of the three variables, write a regular expression (as a string) corresponding to the DFAs given below. Ensure that the regex you provide can be parsed using the parser provided in REP.hs.
*REP> parse (pREof pAlphabet) "A*B*"
Just (RSeq (RStar (RSym A)) (RStar (RSym B)))
You may use any of the posted sample code to check your answers, but only submit the regular expressions themselves.
regex1 should correspond to this DFA:
regex2 should correspond to this DFA:
regex3 should correspond to this DFA:
Screenshots of output
module HW5 where-- imports added for doing tests in ghciimport Parserimport REimport REPregex1 = "(B|A+B)*"regex2 = "A+B+|B+A+|e"regex3 = "(BA)*(e|AA(BA|AA(BA)*AA)*(e|AA(BA)*))"