In this assignment, you will be writing code to simulate a FSA based regular expression engine.
The system you develop will need to generate the FSA structures that match a given Regex dynamically and then evaluate several series’ of inputs against that FSA to determine whether they are a match.
This assignment requires you to apply concepts and techniques covered in Chapters 0-4 of the Notes on FSAs (see course readings).
You’ll also need to document and thoroughly test your code using unit tests to ensure robust event handling techniques are being used.
The 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)
Programming Language/Software Requirements
Version Control System
Your work must be stored and submitted using GitHub
You will need to log your progress by commenting on your commits
You will need to use Java & JUnit to complete this assignment.
Your code will be run using JDK 11
Your test code will be run using JUnit 4
Your implementation must not use any of the programming language’s inbuilt regular
expression parsing/evaluation libraries/classes.
Your implementation may use any other libraries/classes available in the standard JDK
and JUnit, but no other external libraries/classes.
Your programs will be executed with the commands shown below:
or for verbose mode
java RegexEngine -v
Tests compiled with:
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:
- 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
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).
本网站支持 Alipay WeChatPay PayPal等支付方式
E-mail: email@example.com 微信号:vipnxx