Question: system will need to: Parse an basic regular expression from standard input Generate a - NFA to evaluate the regular expression Evaluate the subsequent inputs

system will need to:
Parse an basic regular expression from standard input
Generate a -NFA to evaluate the regular expression
Evaluate the subsequent inputs against the regular expression.
Event Driven systems are particularly prone to errors so you'll also need to:
Document your planning of the system (See Logging/Documenting your Progress below)
Write your own suite of test cases for your code (See Testing your Code below)Compiled with
javac RegexEngine.java
Run with:
java RegexEngine
or for verbose mode
java RegexEngine -v
Tests compiled with:
javac *_Test.java
Each Test run with:
java org.junit.runner.JUnitCore TestName_Test Your program will need to read input from the terminal/command line's standard input (System.in).
The expected input format is as follows:
(ab)*|c+
abc
ccc. The input begins with the regular expression to test.
In this assignment, a regular expression can consist of lower and upper case letters, numbers, spaces, the alternation operator (|), the Kleene star and Kleene plus operators (* and +), as well as brackets (( and )).
You are not expected to handle nested brackets.
Invalid input in this section should cause the program to print an error message and exit with an exit code of 1.
The next section of input contains the input strings to evaluate against the regular expression.
Each string is on its own line; when a new line is entered, another string begins (don't forget to reset states)
A string can be empty/blank.
A string can contain whitespace and other control characters.
This repeats until the program is terminated with a SIGTERM (Ctrl-C).Under normal mode
After the user has entered the regex your program should print ready
Your program should then print true or false once for each input string provided as they are entered.
If the input string matches the regular expression, print true
If the input string does not match, print false
The input string should be evaluated for an exact match
i.e. the whole string from start to end must exactly match the regular expression to be accepted.
A string containing a match, but not exactly matching should print false.
Example (user input is grey, output is highlighted pink)
(ab)*|c+
ready
abc
false
ccc
true. Under verbose mode
After the user has entered the regex your program should print a transition table for the -NFA generated followed by the word ready
The transition table does not have to exactly match the example below, but does need to reflect the -NFA generated by your system;
this is for manual review and your own debugging.
Your program should begin to print true or false as the user enters the input strings for each character input (including the initial state),
If the system is currently in an accepting state, print true
Otherwise, print false
Hint: After a user has entered the input string the most recent output should match the normal output
Example (user input is grey, output is highlighted pink)
(ab)*|c+
epsilon a b c other
>q0 q1,q5
q1 q2,q8
q2 q3
q3 q4
q4 q1
q5 q6
q6 q7
q7 q5,q8
*q8
ready
true
a
false
b
true
c
false
true
c
true
c
true
c
true

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!