Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please to this in ocaml. Needed urgently. I will thumb up let rec nfa_sim (nfa: nfa) (states: state list) (input: symbol list) : bool =
Please to this in ocaml. Needed urgently. I will thumb up
let rec nfa_sim (nfa: nfa) (states: state list) (input: symbol list) : bool =
let states' = eps_clos nfa states
in
Implement the function nfa_sim: nfa -> state list -> symbol list -> bool. nfa_sim nfa states input should: Let states' be the e-closure of states (we've done this part for you) If we're out of input, return true if any state in states' is an accepting state, otherwise return false. Otherwise, look at the next symbol, update the set of states accordingly, and call nfa_sim with the new set of states. Hint: You may (or may not) find the standard library function List.exists helpful. Implement the function nfa_sim: nfa -> state list -> symbol list -> bool. nfa_sim nfa states input should: Let states' be the e-closure of states (we've done this part for you) If we're out of input, return true if any state in states' is an accepting state, otherwise return false. Otherwise, look at the next symbol, update the set of states accordingly, and call nfa_sim with the new set of states. Hint: You may (or may not) find the standard library function List.exists helpful
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started