Question: Learning Haskell and I am stuck. Please help!! Background In this assignment, let's consider slightly augmented version of the deterministic finite automatorn from Assignment 2,
Learning Haskell and I am stuck. Please help!!

Background In this assignment, let's consider slightly augmented version of the deterministic finite automatorn from Assignment 2, which it given in the following figure and formally described below. 0,1 0,1 start (SoS1 0,1 s0,1 2 S4 0,1 Recall, a Deterministic Finite Automaton (FDA) is as quadruple A over an alphabet , A(Q.as, F,5) where Q is a set of states, qs E Q is a special start state, F is a set of accepting states, and is a transition function from a current state and input symbol to a next state, 6:0 xE-Q. For example, the automaton depicted above is defined as, dsSo F (s3) (s4,0, s4), (s4.1, s4). (s4,., S4) Where [0, 1, . Functional Requirements: Create a Haskell language program that can be used to execute any arbitrary Deterministic Finite Automaton corresponding to the FDA definition above. Represent the DFA as a four-tuple a. represent each state with its name as a String b. represents all states as a list of states c. represent each transition as three tuple and the list of transitions as a list. 1. 2. To assist you, implement the following functions in your solution: a. dfaFactory - returns a "hardcoded" DFA definition (ie. a fouf tuple) b. getStates, getFirstState, get FinalStates, and get Transitions -take a single DFA argument and return the corresponding component of the DFA. getFromState, getLabel, and getToState - take a single transition argument and return the corresponding component of the transition c. d. matchTransition - takes a state, a input character, and a transition and returns True, if e. findNextState -takes a DFA, an input character, and a current state and returns the f. dfaAccept- takes a DFA and an input String and returns True if the DFA accepts the 8. dfaAccept1 -takes an input string, a current state, and a DFA. Decompose the input ithe given state and input matches the from state and label of the given transition state in the DFA based on this input and state. input and False otherwise. Use this to call the dfaAcceptl helper function string one character pt a time, don't match the entire string since your solution must work for any DFA). This is a recursive function with a base and recursive case. 3. Here are some examples executions your program should handle: Prelude> dfaAccept dfaFactory False Prelude> dfaAccept dfaFactory "1" False Prelude> dfaAccept dfaFactory 1.0 True Prelude> dfaAccept dfaFactory "10.11" True Prelude> dfaAccept dfaFactory "10.10.10" False 4. You can assume the input string contains only characters in . The following built-in Haskell functions should help you: elem item list like the Java ArrayList contains method. It returns True if the item is in the list and False otherwise filter predicateFunction list -applies the single argument predicate function to every item in the list, one at a time. If the predicate function returns True, the given item is included in a new list returned by the filter function, otherwise it is not. The predicate function can be an anonymous lambda function: (1x -> someOtherFunction) otherwise - a no argument function that always returns True. Can be used in a guard type function, such as: Like Java's "if (arga) return true else return false foo arg arg 'a'True I otherwiseFalse
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
