Question
Write a Perl program There is a NFA-to-DFA conversion, the resulting table can be represented in the following form: Your program will read such input
Write a Perl program
There is a NFA-to-DFA conversion, the resulting table can be represented in the following form:
Your program will read such input and produce a list of all used states in one line, in the following format:
States = { q0q1, q0q2, q1 } The program must read input from the standard input (use diamond operator), and produce one line of output to the standard output. You do not need to check format of the table, but simply treat any identifier that starts with q followed by some digits, and possibly again a q followed by digits, and so on, as a state name. The program must be in Perl and you should use regular expressions to extract state names. Use word boundary anchors in order not to extract state names such as aq1q2, qq1, q1q2x, or q1q2q. The states should not be repeated, and they should be lexicographically sorted at the output. Use exact spacing as shown in the example.
State | a I b n | -- + S: q0q1 | q0q11 q1 | q0q11 +- -+--- ---+ q1 | q0q2 | q0q2 | | q0q2 -+ F: q0q2 | q0q11 q1 | q0q11 +- +--- -+- ---+ State | a I b n | -- + S: q0q1 | q0q11 q1 | q0q11 +- -+--- ---+ q1 | q0q2 | q0q2 | | q0q2 -+ F: q0q2 | q0q11 q1 | q0q11 +- +--- -+- ---+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