[SOLVED] CS代考 Put simply, your goal in this assignment is to implement the process from t

30 $

File Name: CS代考_Put_simply,_your_goal_in_this_assignment_is_to_implement_the_process_from_t.zip
File Size: 791.28 KB

5/5 - (1 vote)

Put simply, your goal in this assignment is to implement the process from the previous assignment in code. Specifically,
you’ll get a regular expression, you’ll convert it to a DFA, and then the DFA will be ready to run on input strings in a
single left-to-right pass to determine a match.
This is much simpler than the full-featured regex we’ve used in the practical regex assignments. The grammar contains

Copyright By PowCoder代写加微信 assignmentchef

only the following:
ab to specify two tokens in sequence (token a followed by token b)
a| b to specify two different options (token a OR token b)
(ab) to group a regular expression into a single token
a* to specify any number, including zero, of a token (token a any number of times)
at to specify any number, excluding zero, of a token (token a at least once)
a? to specify an optional token (token a once or not at all)
„and does not contain any character classes. We also are only looking to see if the entire string matches or not, so you
don’t have to worry about finding a match on a substring.
This probably goes without saying, but you may not import re to accomplish this assignment. No fair using compiled
regular expressions to compile regular expressions!
Input/Output Specification
You’ll receive three command-line arguments – a language, a regular expression, and a txt file with test cases. You will
compile the regular expression to a DFA and then run it on all the test cases. The required output is just like the
Deterministic Finite Automata assignment – you’ll print out a table showing the state connections, a list of final nodes,
and the results of tests on the given strings.
Sample Runs
To help you out, I’ve given a couple of sample runs where I’m outputting what my computer does at each stage of the
conversion process. This is not required for you – you only need to output the end. But hopefully this will help you
On each of these sample runs, note that it is quite likely that you won’t end up with your states numbered precisely as
mine have been. This is ok. You should be able to take your own states and find a corresponding state to each of them
in my output (the fancy mathematical term for this is that your solutions don’t need to be identical to mine but they do
need to be isomorphic to mine).
Finally, I want to point out a choice I made here that you don’t have to also do, but that might be helpful. Note that
during the NFA stages, I’ve made each state be a dict of characters to tuples so that I can store multiple connections
with the same character. When we get to DFA, I convert back to the format I showed in the DFA assignment.

程序代写 CS代考加微信: assignmentchef QQ: 1823890830 Email: [email protected]

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS代考 Put simply, your goal in this assignment is to implement the process from t
30 $